﻿.um-page.ai-chat-page {
    --ai-navy: #044464;
    --ai-gold: #e2c064;
    --ai-cyan: #1fabe2;
    --ai-text: #2c3e4a;
    --ai-muted: #6b8290;
    --ai-line: #d5e2e9;
    --ai-surface: #fff;
    --ai-bg: #f4f8fa;
    --ai-user: #044464;
    --ai-user-text: #fff;
    --ai-shadow: 0 12px 30px rgba(4, 68, 100, 0.1);
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100vh - 155px) !important;
    min-height: 560px !important;
    max-height: calc(100vh - 140px);
}

    .um-page.ai-chat-page > .content__section--heading {
        flex-shrink: 0;
        margin-bottom: 10px !important;
    }

    .um-page.ai-chat-page > .content__section--items {
        display: grid !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
        padding-bottom: 0 !important;
    }

        .um-page.ai-chat-page > .content__section--items > .container-fluid {
            display: grid !important;
            height: 100% !important;
            min-height: 0 !important;
            padding: 0 !important;
        }

.ai-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ai-heading-mark {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
    border-radius: 14px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #044464, #0a6a8f) !important;
    color: #e2c064 !important;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(4, 68, 100, 0.22);
    flex-shrink: 0;
}

.ai-heading-subtitle {
    margin-top: 3px;
    font-size: 12px;
    color: var(--ai-muted);
    font-weight: 500;
}

.ai-new-chat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--ai-line);
    background: var(--ai-surface);
    color: var(--ai-navy);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

    .ai-new-chat:hover:not(:disabled) {
        border-color: color-mix(in srgb, var(--ai-navy) 35%, var(--ai-line));
        box-shadow: var(--ai-shadow);
    }

    .ai-new-chat:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.ai-workspace {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 22px;
    overflow: hidden;
    background: radial-gradient(900px 260px at 80% -40px, rgba(226, 192, 100, 0.22), transparent 55%), radial-gradient(700px 220px at 0 0, rgba(31, 171, 226, 0.12), transparent 50%), #fff;
    box-shadow: 0 8px 28px rgba(4, 68, 100, 0.08);
    border: 1px solid #d5e2e9;
}

.ai-stage {
    min-height: 0;
    overflow-y: auto;
    padding: 28px 22px 12px;
    display: flex;
    flex-direction: column;
}

    .ai-stage::-webkit-scrollbar {
        width: 8px;
    }

    .ai-stage::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--ai-navy) 22%, transparent);
        border-radius: 99px;
    }


/* Empty / hero */

.ai-hero {
    width: min(860px, 100%);
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 8px 8px;
}

.ai-hero-orb {
    width: 88px !important;
    height: 88px !important;
    min-width: 88px;
    min-height: 88px;
    border-radius: 28px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: #e2c064 !important;
    font-size: 38px;
    background: linear-gradient(155deg, #044464 0%, #0b6d92 58%, #1fabe2 140%) !important;
    box-shadow: 0 16px 36px rgba(4, 68, 100, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ai-hero h4 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--ai-navy);
}

.ai-hero p {
    margin: 8px 0 0;
    max-width: 420px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--ai-muted);
}

.ai-suggest-grid {
    width: 100%;
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ai-chat-page button.ai-suggest,
.ai-suggest {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 128px;
    text-align: right;
    padding: 16px !important;
    border-radius: 16px !important;
    border: 1px solid #d5e2e9 !important;
    background: #fff !important;
    color: inherit !important;
    font: inherit;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(4, 68, 100, 0.06);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

    .ai-suggest:hover:not(:disabled) {
        transform: translateY(-2px);
        border-color: color-mix(in srgb, var(--ai-gold) 55%, var(--ai-line));
        box-shadow: var(--ai-shadow);
    }

    .ai-suggest:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.ai-suggest-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 68, 100, 0.08);
    color: var(--ai-navy);
    font-size: 15px;
}

.ai-suggest strong {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--ai-navy);
}

.ai-suggest em {
    font-style: normal;
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--ai-muted);
}


/* Thread */

.ai-thread {
    width: min(820px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 12px;
}

.ai-row {
    display: flex;
    width: 100%;
}

    .ai-row.is-user {
        justify-content: flex-start;
    }

    .ai-row.is-assistant {
        align-items: flex-start;
        gap: 10px;
    }

.ai-bubble {
    max-width: 100%;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}

    .ai-bubble.is-user {
        max-width: min(78%, 640px);
        padding: 11px 16px;
        background: linear-gradient(165deg, #0a5a7a, var(--ai-user));
        color: var(--ai-user-text);
        border-radius: 16px 16px 4px 16px;
        box-shadow: 0 8px 18px rgba(4, 68, 100, 0.16);
    }

    .ai-bubble.is-assistant {
        padding: 12px 16px 14px;
        background: var(--ai-surface);
        color: var(--ai-text);
        border: 1px solid var(--ai-line);
        border-radius: 4px 18px 18px 18px;
        box-shadow: 0 6px 18px rgba(4, 68, 100, 0.04);
    }

.ai-bubble-text + .ai-file-pick,
.ai-bubble-text + .ai-table {
    margin-top: 12px;
}

.ai-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #044464, #0a6a8f);
    color: #e2c064;
    font-size: 15px;
    margin-top: 2px;
}

    .ai-avatar.is-pulse {
        animation: ai-pulse 1.4s ease-in-out infinite;
    }

.ai-col {
    min-width: 0;
    flex: 1 1 auto;
    max-width: calc(100% - 46px);
}


/* File pick + sources */

.ai-file-pick {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-file-pick-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ai-muted);
}

.ai-chat-page button.ai-file-card,
.ai-file-card {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    border: 1px solid #d5e2e9 !important;
    background: #f4f8fa !important;
    color: inherit !important;
    font: inherit;
    text-align: right;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
}

    .ai-file-card:hover:not(:disabled) {
        border-color: color-mix(in srgb, var(--ai-navy) 40%, var(--ai-line));
        transform: translateX(-2px);
    }

    .ai-file-card:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

.ai-file-card-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 68, 100, 0.08);
    color: var(--ai-navy);
    font-size: 16px;
}

.ai-file-card-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .ai-file-card-body strong {
        font-size: 13px;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ai-file-card-body em {
        font-style: normal;
        font-size: 11px;
        color: var(--ai-muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.ai-file-card-go {
    color: var(--ai-muted);
    font-size: 12px;
}

.ai-table {
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--ai-line);
    background: var(--ai-surface);
}

    .ai-table .mud-table {
        background: transparent;
    }

    .ai-table .mud-table-head .mud-table-cell {
        font-weight: 800;
        color: var(--ai-navy);
        background: #edf4f7;
    }

.ai-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    padding-inline-start: 2px;
}

.ai-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ai-muted);
    font: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
}

    .ai-action:hover {
        background: color-mix(in srgb, var(--ai-navy) 7%, transparent);
        color: var(--ai-navy);
    }

.ai-sources {
    margin-top: 8px;
}

.ai-sources-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ai-muted);
}

.ai-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-source {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    height: 34px;
    padding: 0 10px 0 8px;
    border-radius: 999px;
    border: 1px solid var(--ai-line);
    background: var(--ai-surface);
    color: var(--ai-text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
}

    .ai-source:hover {
        border-color: color-mix(in srgb, var(--ai-navy) 40%, var(--ai-line));
        transform: translateY(-1px);
    }

    .ai-source i {
        color: var(--ai-navy);
    }

    .ai-source span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 180px;
        font-weight: 600;
    }

    .ai-source em {
        font-style: normal;
        font-size: 10px;
        font-weight: 800;
        color: var(--ai-gold);
    }


/* Thinking */

.ai-thinking {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 4px 16px 16px 16px;
    background: var(--ai-surface);
    border: 1px solid var(--ai-line);
    color: var(--ai-muted);
}

    .ai-thinking span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--ai-navy);
        opacity: .35;
        animation: ai-thinking-dot 1.1s infinite ease-in-out;
    }

        .ai-thinking span:nth-child(2) {
            animation-delay: .15s;
        }

        .ai-thinking span:nth-child(3) {
            animation-delay: .3s;
        }

    .ai-thinking em {
        font-style: normal;
        font-size: 12px;
        font-weight: 600;
    }

@keyframes ai-thinking-dot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .3;
    }

    30% {
        transform: translateY(-4px);
        opacity: .95;
    }
}

@keyframes ai-pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}


/* Composer dock */

.ai-dock {
    flex-shrink: 0;
    padding: 10px 20px 16px;
    background: linear-gradient(180deg, rgba(244, 248, 250, 0), #fff 36%);
}

.ai-error {
    width: min(820px, 100%);
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(192, 57, 43, 0.1);
    color: #a83228;
    font-size: 12.5px;
    font-weight: 600;
}

.ai-error-close {
    margin-right: auto;
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.ai-composer {
    width: min(820px, 100%);
    margin: 0 auto;
    display: flex !important;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 10px 10px 14px !important;
    border-radius: 20px !important;
    border: 1px solid #c9dbe4 !important;
    background: #fff !important;
    box-shadow: 0 14px 36px rgba(4, 68, 100, 0.12);
}

    .ai-composer:focus-within {
        border-color: color-mix(in srgb, var(--ai-navy) 45%, var(--ai-line));
        box-shadow: 0 0 0 3px rgba(4, 68, 100, 0.08), 0 12px 32px rgba(4, 68, 100, 0.1);
    }

.ai-composer-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px !important;
    max-height: 148px;
    height: auto !important;
    border: 0 !important;
    outline: none !important;
    resize: none;
    background: transparent !important;
    color: var(--ai-text);
    font: inherit;
    font-size: 15px !important;
    line-height: 1.7;
    padding: 10px 4px !important;
    box-shadow: none !important;
    field-sizing: content;
}

    .ai-composer-input::placeholder {
        color: color-mix(in srgb, var(--ai-muted) 80%, transparent);
    }

    .ai-composer-input:disabled {
        opacity: .7;
    }

.ai-chat-page button.ai-send,
.ai-send {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: linear-gradient(165deg, #0a5a7a, #044464) !important;
    color: #e2c064 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 8px 16px rgba(4, 68, 100, 0.22);
    transition: transform .15s ease, filter .15s ease;
}

    .ai-send:hover:not(:disabled) {
        transform: translateY(-1px);
        filter: brightness(1.08);
    }

    .ai-send:disabled {
        opacity: .4;
        cursor: not-allowed;
        box-shadow: none;
    }

.ai-dock-note {
    width: min(820px, 100%);
    margin: 8px auto 0;
    text-align: center;
    font-size: 11px;
    color: var(--ai-muted);
}

    .ai-dock-note i {
        margin-left: 4px;
        color: var(--ai-navy);
    }

.ai-locked {
    margin: 40px 16px;
}


/* Dark theme */

.layout-theme.theme-dark .um-page.ai-chat-page,
body.app-dark-mode .um-page.ai-chat-page {
    --ai-bg: #15222d;
    --ai-surface: #1a2836;
    --ai-text: #e8f1f7;
    --ai-muted: #9db6c7;
    --ai-line: rgba(150, 191, 218, 0.28);
    --ai-navy: #7eb6d4;
    --ai-gold: #e2c064;
    --ai-user: #2b5278;
    --ai-user-text: #f3f7fb;
    --ai-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.layout-theme.theme-dark .ai-heading-subtitle,
body.app-dark-mode .ai-heading-subtitle {
    color: #9db6c7;
}

.layout-theme.theme-dark .ai-heading-mark,
body.app-dark-mode .ai-heading-mark,
.layout-theme.theme-dark .ai-hero-orb,
body.app-dark-mode .ai-hero-orb,
.layout-theme.theme-dark .ai-avatar,
body.app-dark-mode .ai-avatar {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.layout-theme.theme-dark .ai-new-chat,
body.app-dark-mode .ai-new-chat {
    background: #1a2836 !important;
    border-color: rgba(150, 191, 218, 0.28) !important;
    color: #e8f1f7 !important;
}

.layout-theme.theme-dark .ai-workspace,
body.app-dark-mode .ai-workspace {
    background: linear-gradient(358deg,rgba(11, 48, 67, 1) 0%, rgba(13, 58, 80, 1) 50%, rgba(121, 103, 57, 1) 100%), #15222d !important;
    border-color: rgba(150, 191, 218, 0.22) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.layout-theme.theme-dark .ai-hero h4,
body.app-dark-mode .ai-hero h4 {
    color: #e8f1f7 !important;
}

.layout-theme.theme-dark .ai-hero p,
body.app-dark-mode .ai-hero p {
    color: #9db6c7 !important;
}

.layout-theme.theme-dark .ai-chat-page button.ai-suggest,
.layout-theme.theme-dark .ai-suggest,
body.app-dark-mode .ai-chat-page button.ai-suggest,
body.app-dark-mode .ai-suggest {
    background: #1a2836 !important;
    border-color: rgba(150, 191, 218, 0.28) !important;
    color: #e8f1f7 !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

    .layout-theme.theme-dark .ai-suggest:hover:not(:disabled),
    body.app-dark-mode .ai-suggest:hover:not(:disabled) {
        background: #1f3142 !important;
        border-color: rgba(226, 192, 100, 0.45) !important;
    }

.layout-theme.theme-dark .ai-suggest-icon,
body.app-dark-mode .ai-suggest-icon {
    background: rgba(150, 191, 218, 0.14);
    color: #7eb6d4;
}

.layout-theme.theme-dark .ai-suggest strong,
body.app-dark-mode .ai-suggest strong {
    color: #e8f1f7 !important;
}

.layout-theme.theme-dark .ai-suggest em,
body.app-dark-mode .ai-suggest em {
    color: #9db6c7 !important;
}

.layout-theme.theme-dark .ai-bubble.is-user,
body.app-dark-mode .ai-bubble.is-user {
    background: linear-gradient(165deg, #2b6f8f, #2b5278) !important;
    color: #f3f7fb !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.layout-theme.theme-dark .ai-bubble.is-assistant,
body.app-dark-mode .ai-bubble.is-assistant {
    background: #1a2836 !important;
    color: #e8f1f7 !important;
    border-color: rgba(150, 191, 218, 0.22) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.layout-theme.theme-dark .ai-chat-page button.ai-file-card,
.layout-theme.theme-dark .ai-file-card,
body.app-dark-mode .ai-chat-page button.ai-file-card,
body.app-dark-mode .ai-file-card {
    background: #15222d !important;
    border-color: rgba(150, 191, 218, 0.28) !important;
    color: #e8f1f7 !important;
}

.layout-theme.theme-dark .ai-file-card-icon,
body.app-dark-mode .ai-file-card-icon {
    background: rgba(150, 191, 218, 0.14);
    color: #7eb6d4;
}

.layout-theme.theme-dark .ai-file-card-body em,
body.app-dark-mode .ai-file-card-body em,
.layout-theme.theme-dark .ai-file-pick-label,
body.app-dark-mode .ai-file-pick-label,
.layout-theme.theme-dark .ai-sources-label,
body.app-dark-mode .ai-sources-label {
    color: #9db6c7;
}

.layout-theme.theme-dark .ai-table,
body.app-dark-mode .ai-table {
    background: #1a2836;
    border-color: rgba(150, 191, 218, 0.22);
}

    .layout-theme.theme-dark .ai-table .mud-table,
    .layout-theme.theme-dark .ai-table .mud-table-container,
    .layout-theme.theme-dark .ai-table .mud-data-grid,
    body.app-dark-mode .ai-table .mud-table {
        background: transparent !important;
        color: #e8f1f7 !important;
    }

    .layout-theme.theme-dark .ai-table .mud-table-head .mud-table-cell,
    body.app-dark-mode .ai-table .mud-table-head .mud-table-cell {
        background: #213344 !important;
        color: #7eb6d4 !important;
    }

    .layout-theme.theme-dark .ai-table .mud-table-cell,
    body.app-dark-mode .ai-table .mud-table-cell {
        color: #e8f1f7 !important;
        border-color: rgba(150, 191, 218, 0.16) !important;
    }

.layout-theme.theme-dark .ai-action,
body.app-dark-mode .ai-action {
    color: #9db6c7;
}

    .layout-theme.theme-dark .ai-action:hover,
    body.app-dark-mode .ai-action:hover {
        background: rgba(150, 191, 218, 0.12);
        color: #e8f1f7;
    }

.layout-theme.theme-dark .ai-source,
body.app-dark-mode .ai-source {
    background: #1a2836 !important;
    border-color: rgba(150, 191, 218, 0.28) !important;
    color: #e8f1f7 !important;
}

    .layout-theme.theme-dark .ai-source i,
    body.app-dark-mode .ai-source i {
        color: #7eb6d4;
    }

.layout-theme.theme-dark .ai-thinking,
body.app-dark-mode .ai-thinking {
    background: #1a2836;
    border-color: rgba(150, 191, 218, 0.22);
    color: #9db6c7;
}

    .layout-theme.theme-dark .ai-thinking span,
    body.app-dark-mode .ai-thinking span {
        background: #7eb6d4;
    }

.layout-theme.theme-dark .ai-dock,
body.app-dark-mode .ai-dock {
    background: #0c354a;
}

.layout-theme.theme-dark .ai-error,
body.app-dark-mode .ai-error {
    background: rgba(192, 57, 43, 0.18);
    color: #f3b4ae;
}

.layout-theme.theme-dark .ai-composer,
body.app-dark-mode .ai-composer {
    background: #1a2836 !important;
    border-color: rgba(150, 191, 218, 0.28) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

    .layout-theme.theme-dark .ai-composer:focus-within,
    body.app-dark-mode .ai-composer:focus-within {
        border-color: rgba(126, 182, 212, 0.55) !important;
        box-shadow: 0 0 0 3px rgba(126, 182, 212, 0.14), 0 14px 36px rgba(0, 0, 0, 0.35);
    }

.layout-theme.theme-dark .ai-composer-input,
body.app-dark-mode .ai-composer-input {
    color: #e8f1f7 !important;
    background: transparent !important;
    caret-color: #e2c064;
}

    .layout-theme.theme-dark .ai-composer-input::placeholder,
    body.app-dark-mode .ai-composer-input::placeholder {
        color: #8aa3b5 !important;
    }

.layout-theme.theme-dark .ai-chat-page button.ai-send,
.layout-theme.theme-dark .ai-send,
body.app-dark-mode .ai-chat-page button.ai-send,
body.app-dark-mode .ai-send {
    background: linear-gradient(165deg, #2b6f8f, #1d4f6a) !important;
    color: #e2c064 !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.layout-theme.theme-dark .ai-dock-note,
body.app-dark-mode .ai-dock-note {
    color: #9db6c7;
}

    .layout-theme.theme-dark .ai-dock-note i,
    body.app-dark-mode .ai-dock-note i {
        color: #7eb6d4;
    }

.layout-theme.theme-dark .ai-locked,
body.app-dark-mode .ai-locked {
    background: #1a2836;
    border-color: rgba(150, 191, 218, 0.28);
    color: #9db6c7;
}


@media (max-width: 1800px) {
    .um-page.ai-chat-page {
        height: calc(100vh - 140px) !important;
    }
}

@media (max-width: 768px) {
    .um-page.ai-chat-page {
        height: auto !important;
        max-height: none;
        min-height: calc(100vh - 150px) !important;
    }

    .ai-heading-mark {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 16px;
    }

    .ai-new-chat span {
        display: none;
    }

    .ai-stage {
        padding: 12px 10px 6px;
    }

    .ai-suggest-grid {
        grid-template-columns: 1fr;
    }

    .ai-bubble.is-user {
        max-width: 92%;
    }

    .ai-col {
        max-width: calc(100% - 40px);
    }

    .ai-dock {
        padding: 6px 10px 10px;
    }

    .ai-source span {
        max-width: 120px;
    }
}

/* =========================================================
   AI CHAT - MESSAGE LAYOUT STABILITY FIX
   ========================================================= */
.ai-thread {
    width: min(820px,100%);
    margin: 0 auto;
    display: flex !important;
    flex-direction: column !important;
    gap: 18px;
    min-width: 0;
    flex: 0 0 auto;
    padding-bottom: 12px
}

.ai-row {
    position: relative;
    display: flex !important;
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    clear: both
}

    .ai-row.is-user {
        justify-content: flex-start;
        align-items: flex-start
    }

    .ai-row.is-assistant {
        justify-content: flex-start;
        align-items: flex-start;
        gap: 10px
    }

.ai-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    max-width: calc(100% - 46px)
}

.ai-bubble {
    position: relative;
    display: block;
    box-sizing: border-box;
    min-width: 0;
    line-height: 1.9;
    overflow-wrap: anywhere;
    word-break: break-word
}

    .ai-bubble.is-user {
        width: fit-content;
        max-width: min(78%,640px);
        white-space: pre-wrap
    }

    .ai-bubble.is-assistant {
        width: 100%;
        max-width: 100%;
        white-space: normal;
        overflow: hidden
    }

.ai-bubble-text {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word
}

.ai-file-pick {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 8px
}

.ai-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    overflow-y: hidden;
    box-sizing: border-box
}

    .ai-table .mud-table-root, .ai-table .mud-table, .ai-table .mud-table-container, .ai-table .mud-data-grid {
        max-width: 100%
    }

.ai-actions {
    display: flex;
    width: 100%;
    flex: 0 0 auto;
    clear: both;
    margin-top: 6px
}

.ai-avatar {
    flex: 0 0 36px
}

.ai-stage {
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column
}

@media(max-width:768px) {
    .ai-col {
        width: 0;
        max-width: calc(100% - 40px)
    }

    .ai-bubble.is-user {
        max-width: 92%
    }
}



.ai-chart {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 16px;
    background: rgba(255, 255, 255, .72);
    overflow: hidden;
}

.ai-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

    .ai-chart-header strong {
        display: block;
        font-size: 15px;
        font-weight: 700;
        color: #1e293b;
    }

    .ai-chart-header span {
        display: block;
        margin-top: 4px;
        font-size: 12px;
        color: #64748b;
    }

.ai-chart .apexcharts-canvas {
    direction: ltr;
}

.ai-chart .apexcharts-title-text,
.ai-chart .apexcharts-xaxis-label,
.ai-chart .apexcharts-yaxis-label {
    font-family: inherit !important;
}

@media (max-width: 768px) {
    .ai-chart {
        padding: 10px;
        overflow-x: auto;
    }
}