/* Behsaz AI Chat — dedicated stylesheet (Phase 3A) */

/*#region AI Conversation Sidebar */
.Ai-Assistant-Shell {
    display: flex;
    flex-direction: row;
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
}

.Ai-ConversationSidebar {
    width: 280px;
    min-width: 240px;
    max-width: 320px;
    border-inline-end: 1px solid var(--Theme-BorderColor, #d7dde5);
    background: var(--Theme-PanelBackground, #f7f9fc);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    box-sizing: border-box;
}

.Ai-ConversationSidebar-Header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.Ai-ConversationSidebar-Title {
    font-weight: 600;
    font-size: 14px;
}

.Ai-ConversationSidebar-Search {
    display: flex;
    gap: 6px;
    align-items: center;
}

.Ai-ConversationSidebar-SearchInput {
    flex: 1 1 auto;
    min-width: 0;
}

.Ai-ConversationSidebar-Utilities {
    display: flex;
    align-items: center;
    gap: 6px;
}

.Ai-ConversationSidebar-List {
    flex: 1 1 auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 120px;
}

.Ai-ConversationSidebar-Item {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 4px;
    background: transparent;
}

.Ai-ConversationSidebar-Item-Selected {
    border-color: var(--Theme-AccentColor, #2f6fed);
    background: rgba(47, 111, 237, 0.08);
}

.Ai-ConversationSidebar-ItemButton {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    border: none;
    background: transparent;
    text-align: start;
    cursor: pointer;
    padding: 6px 8px;
}

.Ai-ConversationSidebar-ItemTitle {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
}

.Ai-ConversationSidebar-ItemStatus {
    display: block;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.78;
    margin-top: 2px;
    color: var(--theme-accent, #3a6ea5);
}

.Ai-ConversationSidebar-ItemMeta {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
}

.Ai-ConversationSidebar-ItemActions {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 120ms ease;
}

.Ai-ConversationSidebar-Item:hover .Ai-ConversationSidebar-ItemActions,
.Ai-ConversationSidebar-Item-Selected .Ai-ConversationSidebar-ItemActions {
    opacity: 1;
}

.Ai-ConversationSidebar-Empty {
    padding: 12px 8px;
    opacity: 0.7;
    font-size: 12px;
}

.Ai-ConversationSidebar-RenameInput {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 6px;
}

.Ai-ConversationDrawer-Toggle,
.Ai-ConversationDrawer-Backdrop {
    display: none;
}

.IsMobileSize .Ai-ConversationDrawer-Toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin: 6px 8px 0;
    padding: 5px 9px;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 7px;
    background: var(--Theme-PanelBackground, #f7f9fc);
    color: inherit;
    cursor: pointer;
    transition: background-color 150ms ease, transform 120ms ease;
}

.IsMobileSize .Ai-ConversationDrawer-Toggle:active {
    transform: scale(0.98);
}

.IsMobileSize .Ai-ConversationDrawer-Backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 40;
    border: 0;
    background: rgba(10, 18, 30, 0.28);
    animation: AiChat-FadeIn 160ms ease both;
}

.IsMobileSize .Ai-ConversationSidebar {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 41;
    width: min(86vw, 320px);
    min-width: 0;
    box-shadow: 0 12px 32px rgba(10, 18, 30, 0.2);
    animation: AiChat-DrawerIn 200ms ease-out both;
}

.Ai-AgentTabShell > .TLayoutGroupContent > .Ai-AgentViewRoot {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

/* Keep execution steps on the visual LEFT (former TDockPanel used direction:ltr). */
.Ai-SessionRow,
.Ai-SessionRow > .TLayoutGroupContent {
    direction: ltr;
}

.Ai-SessionRow > .TLayoutGroupContent > .Ai-StepsColumn {
    order: 0;
}

.Ai-SessionRow > .TLayoutGroupContent > .Ai-ChatColumnHost {
    order: 1;
}

[dir="rtl"] .Ai-ChatColumn,
[dir="rtl"] .Ai-AgentPanel {
    direction: rtl;
}
/*#endregion*/

/*#region Durable AI memory manager */
.Ai-MemoryManager {
    gap: 8px;
    padding: 8px;
    box-sizing: border-box;
}

.Ai-MemoryManager-Help,
.Ai-MemoryManager-Empty {
    color: var(--Theme-ForegroundColor-Light, #666);
    font-size: 12px;
    line-height: 1.6;
}

.Ai-MemoryManager-Item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding-block: 4px;
}

.Ai-MemoryManager-Content {
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.Ai-MemoryManager-Meta {
    direction: ltr;
    unicode-bidi: isolate;
    color: var(--Theme-ForegroundColor-Light, #777);
    font-size: 11px;
}

.Ai-MemoryManager-RuleBody {
    color: var(--Theme-ForegroundColor-Light, #555);
    font-size: 12px;
}
/*#endregion*/

/*#region Calm AI motion and state transitions */
.Ai-AgentViewRoot {
    --Ai-Motion-Fast: 120ms;
    --Ai-Motion-Normal: 180ms;
    --Ai-Motion-Slow: 260ms;
    position: relative;
}

.Ai-AgentViewRoot .Ai-Thinking-Block {
    min-height: 1.5em;
    background: linear-gradient(90deg, currentColor 20%, var(--Theme-AccentColor, #3978d6) 48%, currentColor 76%);
    background-size: 220% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: AiChat-ThinkingShimmer 1.8s ease-in-out infinite;
}

.Ai-AgentViewRoot .Ai-LiveStatus {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: 100%;
    max-width: 100%;
    border: 0;
    padding: .35rem .15rem;
    background: transparent;
    cursor: pointer;
    text-align: start;
    font: inherit;
}

/* Canonical Turn TransientStatus — single line outside Messages[] */
.Ai-AgentViewRoot .Ai-TransientStatus {
    margin-block: .35rem .55rem;
    padding-inline: .35rem;
}

.Ai-AgentViewRoot .Ai-LiveStatus-Dot {
    flex: 0 0 auto;
    opacity: .7;
    animation: AiChat-ThinkingShimmer 1.8s ease-in-out infinite;
}

.Ai-AgentViewRoot .Ai-LiveStatus-Text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: linear-gradient(90deg, currentColor 20%, var(--Theme-AccentColor, #3978d6) 48%, currentColor 76%);
    background-size: 220% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: AiChat-ThinkingShimmer 1.8s ease-in-out infinite;
}

.Ai-AgentViewRoot .Ai-LiveStatus-Chevron {
    flex: 0 0 auto;
    opacity: .45;
}

.Ai-AgentViewRoot .Ai-ExecutionSummary {
    display: inline-flex;
    margin-top: .55rem;
    padding: .25rem .55rem;
    border-radius: .45rem;
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    background: color-mix(in srgb, var(--Theme-AccentColor, #3978d6) 8%, transparent);
    cursor: pointer;
    font-size: .9em;
}

.Ai-AgentViewRoot .Ai-Md-Table {
    width: 100%;
    max-width: 100%;
    margin: .85rem 0;
    border: 1px solid color-mix(in srgb, var(--Theme-BorderColor, #c7d0dc) 88%, currentColor 12%);
    border-spacing: 0;
    border-collapse: separate;
    border-radius: .65rem;
    background: color-mix(in srgb, var(--Theme-SurfaceAlt, #fff) 97%, transparent);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08),
        0 5px 16px rgba(15, 23, 42, .045);
    font-size: .93em;
    line-height: 1.65;
    overflow: hidden;
}

.Ai-AgentViewRoot .Ai-Md-Table th,
.Ai-AgentViewRoot .Ai-Md-Table td {
    padding: .55rem .75rem;
    border: 0;
    border-block-end: 1px solid color-mix(in srgb, var(--Theme-BorderColor, #d7dde5) 82%, transparent);
    text-align: start;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.Ai-AgentViewRoot .Ai-Md-Table th + th,
.Ai-AgentViewRoot .Ai-Md-Table td + td {
    border-inline-start: 1px solid color-mix(in srgb, var(--Theme-BorderColor, #d7dde5) 82%, transparent);
}

.Ai-AgentViewRoot .Ai-Md-Table thead th {
    padding-block: .62rem;
    border-block-end-color: color-mix(in srgb, var(--Theme-AccentColor, #4472c4) 58%, transparent);
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--Theme-AccentColor, #4472c4) 92%, white 8%),
        var(--Theme-AccentColor, #4472c4));
    color: #fff;
    font-weight: 650;
    letter-spacing: .01em;
    vertical-align: middle;
}

.Ai-AgentViewRoot .Ai-Md-Table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--Theme-AccentColor, #4472c4) 5%, transparent);
}

.Ai-AgentViewRoot .Ai-Md-Table tbody tr:hover td {
    background: color-mix(in srgb, var(--Theme-AccentColor, #4472c4) 9%, transparent);
}

.Ai-AgentViewRoot .Ai-Md-Table tbody tr:last-child td {
    border-block-end: 0;
}

.Ai-AgentViewRoot .Ai-Md-Table td strong {
    font-weight: 650;
}

.Ai-AgentViewRoot .Ai-Md-Table .Ai-Md-Inline {
    white-space: normal;
}

.Ai-AgentViewRoot .Ai-Md-Ol {
    margin: .4rem 0 .4rem 1.2rem;
    padding: 0;
}

.Ai-AgentViewRoot .Ai-Input-ConversationBtn,
.Ai-AgentViewRoot .Ai-Suggestion-Chip,
.Ai-AgentViewRoot .Ai-Question-Choice-Button,
.Ai-AgentViewRoot .Ai-Input-AttachmentChip,
.Ai-AgentViewRoot .Ai-ExecutionPlan-Step,
.Ai-ConversationSidebar-Item {
    transition: transform var(--Ai-Motion-Fast) ease,
        opacity var(--Ai-Motion-Normal) ease,
        background-color var(--Ai-Motion-Normal) ease,
        border-color var(--Ai-Motion-Normal) ease,
        box-shadow var(--Ai-Motion-Normal) ease;
}

.Ai-AgentViewRoot .Ai-Suggestion-Chip:hover,
.Ai-AgentViewRoot .Ai-Question-Choice-Button:hover {
    transform: translateY(-1px);
}

.Ai-AgentViewRoot .Ai-Suggestion-Chip:active,
.Ai-AgentViewRoot .Ai-Question-Choice-Button:active,
.Ai-AgentViewRoot .Ai-Input-ConversationBtn:active {
    transform: scale(.98);
}

.Ai-AgentViewRoot .Ai-Input-AttachmentChip.is-uploading {
    opacity: .78;
    animation: AiChat-UploadBreath 1.5s ease-in-out infinite;
}

.Ai-AgentViewRoot .Ai-Input-AttachmentChip.is-ready {
    opacity: 1;
}

.Ai-AgentViewRoot .Ai-Input-AttachmentChip.is-failed {
    animation: AiChat-FailureEmphasis 240ms ease-out 1;
}

.Ai-AgentViewRoot .Ai-Input-AttachmentProgress {
    position: relative;
    width: 54px;
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(47, 111, 237, .14);
}

.Ai-AgentViewRoot .Ai-Input-AttachmentProgressFill {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    border-radius: inherit;
    background: var(--Theme-AccentColor, #2f6fed);
    transition: width var(--Ai-Motion-Normal) ease-out;
}

.Ai-AgentViewRoot .Ai-Input-AttachmentProgressText {
    min-width: 3.4em;
    font-size: 11px;
    opacity: .72;
}

.Ai-AgentViewRoot button:focus-visible,
.Ai-ConversationSidebar button:focus-visible,
.Ai-ConversationSidebar input:focus-visible,
.Ai-ConversationDrawer-Toggle:focus-visible {
    outline: 2px solid var(--Theme-AccentColor, #2f6fed);
    outline-offset: 2px;
}

.Ai-AgentViewRoot .Ai-ExecutionPlan-BarFill {
    transition: width var(--Ai-Motion-Slow) ease-out;
}

.Ai-AgentViewRoot .Ai-Recovery-Banner {
    margin: 6px 12px;
    padding: 8px 10px;
    border: 1px solid rgba(194, 120, 18, .35);
    border-radius: 8px;
    background: rgba(245, 166, 35, .1);
    animation: AiChat-FadeIn var(--Ai-Motion-Normal) ease both;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.Ai-AgentViewRoot .Ai-Recovery-Body {
    min-width: 0;
    flex: 1 1 auto;
}

.Ai-AgentViewRoot .Ai-Recovery-Goal,
.Ai-AgentViewRoot .Ai-Recovery-Warning {
    margin-top: 4px;
    font-size: .92em;
    opacity: .92;
}

.Ai-AgentViewRoot .Ai-Recovery-Actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 6px;
}

.Ai-AgentViewRoot .Ai-Recovery-ReviewButton {
    flex: 0 0 auto;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: 4px 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background-color var(--Ai-Motion-Fast) ease, transform var(--Ai-Motion-Fast) ease;
}

.Ai-AgentViewRoot .Ai-Recovery-ReviewButton:active {
    transform: scale(.98);
}

.Ai-AgentViewRoot .Ai-Input-ConversationBtn.is-listening .Ai-Conversation-Wave {
    animation-duration: 1.25s;
    animation-timing-function: ease-in-out;
}

.Ai-AgentViewRoot .Ai-Input-ConversationBtn.is-voice-thinking .Ai-Conversation-Wave {
    animation-duration: 1.8s;
    opacity: .45;
}

.Ai-AgentViewRoot .Ai-Input-ConversationBtn.is-speaking .Ai-Conversation-Wave {
    animation-duration: .72s;
}

.Ai-AgentViewRoot .Ai-Input-ConversationBtn.is-voice-error .Ai-Conversation-Wave,
.Ai-AgentViewRoot .Ai-Input-ConversationBtn.is-voice-unsupported .Ai-Conversation-Wave {
    animation: none;
    opacity: .25;
}

@keyframes AiChat-ThinkingShimmer {
    0%, 100% { background-position: 110% 0; }
    50% { background-position: -10% 0; }
}

@keyframes AiChat-UploadBreath {
    0%, 100% { opacity: .65; }
    50% { opacity: .9; }
}

@keyframes AiChat-FailureEmphasis {
    0% { transform: translateY(0); }
    45% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes AiChat-FadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes AiChat-DrawerIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

[dir="rtl"] .IsMobileSize .Ai-ConversationSidebar {
    animation-name: AiChat-DrawerInRtl;
}

@keyframes AiChat-DrawerInRtl {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .Ai-AgentViewRoot .Ai-Thinking-Block,
    .Ai-AgentViewRoot .Ai-Conversation-Wave,
    .Ai-AgentViewRoot .Ai-Input-AttachmentChip,
    .Ai-AgentViewRoot .Ai-ExecutionPlan-BarFill,
    .Ai-AgentViewRoot .Ai-ExecutionPlan-Step,
    .Ai-AgentViewRoot .Ai-Suggestion-Chip,
    .Ai-AgentViewRoot .Ai-Recovery-ReviewButton,
    .Ai-AgentViewRoot .Ai-Question-Choice-Button,
    .Ai-ConversationSidebar-Item,
    .Ai-ConversationDrawer-Backdrop,
    .IsMobileSize .Ai-ConversationSidebar,
    .IsMobileSize .Ai-ConversationDrawer-Toggle {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}
/*#endregion*/

/*#region AI Message paging */
.Ai-Messages-LoadingOlder {
    text-align: center;
    font-size: 12px;
    opacity: 0.7;
    padding: 8px 12px;
    flex: 0 0 auto;
}
/*#endregion*/

/*#region AI Composer attachments */
.Ai-Input-Attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 0;
    box-sizing: border-box;
}

.Ai-Input-AttachmentChip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 8px 4px 4px;
    border-radius: 8px;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    background: var(--Theme-PanelBackground, #f7f9fc);
    box-sizing: border-box;
}

.Ai-Input-AttachmentChip.is-uploading {
    opacity: 0.85;
}

.Ai-Input-AttachmentChip.is-failed {
    border-color: #d9534f;
    background: rgba(217, 83, 79, 0.08);
}

.Ai-Input-AttachmentChip.is-ready {
    border-color: var(--Theme-AccentColor, #2f6fed);
}

.Ai-Input-AttachmentThumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    flex: 0 0 auto;
}

.Ai-Input-AttachmentIcon {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.Ai-Input-AttachmentName {
    font-size: 12px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.Ai-Input-AttachmentSize {
    font-size: 11px;
    opacity: 0.65;
    flex: 0 0 auto;
}

.Ai-Input-AttachmentProgress,
.Ai-Input-AttachmentError {
    font-size: 11px;
    opacity: 0.75;
}

.Ai-Input-AttachmentError {
    color: #c0392b;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.IsMobileSize .Ai-Input-AttachmentName {
    max-width: 100px;
}

[dir="rtl"] .Ai-Input-AttachmentChip {
    padding: 4px 4px 4px 8px;
}
/*#endregion*/

/*#region AI message history attachments (Phase 3C) */
.Ai-Message-Attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
}

.Ai-Message-Attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    box-sizing: border-box;
}

.Ai-Message-Attachment-Image {
    cursor: pointer;
}

.Ai-Message-Attachment-Thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    flex: 0 0 auto;
}

.Ai-Message-Attachment-Name {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.Ai-Message-Attachment-File {
    font-size: 13px;
    color: var(--Theme-AccentColor, #2f6fed);
    text-decoration: none;
    word-break: break-all;
}

.Ai-Message-Attachment-File:hover {
    text-decoration: underline;
}

.Ai-Message-Attachment-Audio {
    flex-direction: column;
    align-items: flex-start;
}

.Ai-Message-Attachment-AudioPlayer {
    width: 100%;
    max-width: 280px;
}
/*#endregion*/

/*#region AI composer compact start */
.Ai-AgentViewRoot .Ai-Input-Text {
    min-height: 36px;
    max-height: 200px;
    height: 36px;
}
/*#endregion*/

/*#region AI context usage */
.Ai-Input-TextHost {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-self: stretch;
}

.Ai-Input-TextHost .Ai-Input-Text {
    width: 100%;
}

.Ai-Input-context,
.Ai-ContextUsage {
    position: relative;
    flex: 0 0 auto;
    margin: 0;
    font-size: 11px;
    color: var(--TextColor, #667085);
    line-height: 0;
    align-self: center;
}

.Ai-ContextUsage summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: pointer;
    list-style: none;
}

.Ai-ContextUsage summary::-webkit-details-marker,
.Ai-ContextUsage summary::marker {
    display: none;
    content: none;
}

.Ai-ContextUsage-Donut {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--BorderColor, #9aa4b2);
    border-radius: 50%;
    box-sizing: border-box;
    font-size: 8px;
    font-weight: 600;
    line-height: 1;
}

.Ai-ContextUsage.is-high .Ai-ContextUsage-Donut { border-color: var(--WarningColor, #c98a00); }
.Ai-ContextUsage.is-critical .Ai-ContextUsage-Donut { border-color: var(--DangerColor, #c83b3b); }

.Ai-ContextUsage-Popover {
    position: absolute;
    bottom: calc(100% + 8px);
    inset-inline-end: 0;
    z-index: 30;
    margin: 0;
    padding: 6px 8px;
    border: 1px solid var(--BorderColor, #d0d5dd);
    border-radius: 6px;
    background: var(--BackColor, #fff);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    line-height: 1.4;
}
/*#endregion*/

/*#region Production Agent UX — conversation-first */
.Ai-SessionRow-ConversationFirst,
.Ai-SessionRow-ConversationFirst > .TLayoutGroupContent {
    direction: inherit;
}

/* Scrollable conversation body — keeps composer fixed; welcome/plan no longer clip. */
.Ai-ChatColumn > .Ai-ChatScroll {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scroll-padding-bottom: 16px;
    padding: 11px;
    position: relative;
    overflow-anchor: auto;
    /* Keep wheel/touch scroll; hide the visible vertical scrollbar (Cline-like). */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.Ai-ChatColumn > .Ai-ChatScroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.Ai-JumpToLatest {
    position: sticky;
    bottom: 12px;
    align-self: center;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding: 6px 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    color: #0f172a;
    font-size: 12px;
    cursor: pointer;
}

.Ai-JumpToLatest:hover {
    background: #fff;
}

.Ai-ChatColumn.is-file-drag,
.Ai-InputBox.is-file-drag {
    outline: 2px dashed #3b82f6;
    outline-offset: -4px;
    background-color: rgba(59, 130, 246, 0.08);
}

.Ai-ChatColumn > .Ai-ChatScroll > .Ai-ItemsPanel {
    flex: 0 0 auto;
    overflow: visible;
    min-height: 0;
    width: 100% !important;
}

/* Streaming / expandables change height constantly — do not let them steal scroll anchors. */
.Ai-Message-Markdown,
.Ai-Assistant-ErrorDetails,
.Ai-Code-Block,
.Ai-GeneratedCard {
    overflow-anchor: none;
}

.Ai-ChatColumn > .Ai-ChatScroll > .Ai-Welcome-Panel {
    flex: 0 0 auto;
    justify-content: flex-start;
    align-self: stretch;
    max-width: 100%;
    box-sizing: border-box;
}

.Ai-Welcome-Panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 24px 20px;
    text-align: center;
    /* Override Themes.Common flex:1 which stretched/clipped starters below the fold */
    flex: 0 0 auto !important;
    justify-content: flex-start !important;
    min-height: 0 !important;
}

.Ai-Welcome-Brand {
    font-size: 28px;
    line-height: 1;
    color: var(--Theme-AccentColor, #2f6fed);
}

.Ai-Welcome-Icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--Theme-AccentColor, #2f6fed);
    background: rgba(47, 111, 237, 0.1);
    margin-bottom: 4px;
    padding: 0;
    box-sizing: border-box;
}

.Ai-Welcome-Title {
    font-size: 22px;
    font-weight: 700;
    color: var(--Theme-ForegroundColor, #1a1d21);
}

.Ai-Welcome-Subtitle {
    font-size: 14px;
    line-height: 1.55;
    color: var(--Theme-MutedForeground, #5c6775);
    max-width: 520px;
}

.Ai-AgentIdentity {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    opacity: 0.75;
}

.Ai-AgentIdentity-Icon {
    color: var(--Theme-AccentColor, #2f6fed);
}

.Ai-AgentIdentity-Name {
    font-weight: 600;
}

/* Override Themes.Common hover-only floating toolbar: keep actions after the answer. */
.AI-MessageRow .Ai-Message-Toolbar,
.AI-MessageRow.AI-Assistant .Ai-Message-Toolbar {
    position: static;
    top: auto;
    inset: auto;
    opacity: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    margin-top: 0px;
    margin-bottom: 2px;
    align-self: stretch;
    width: auto;
    max-width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
}

.AI-MessageRow:hover .Ai-Message-Toolbar {
    opacity: 1;
}

/* All toolbar actions share one native button look */
.Ai-Message-Toolbar .Ai-Feedback-Btn {
    flex: 0 0 auto;
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 6px;
    background: transparent;
    opacity: 0.78;
    box-shadow: none;
    cursor: pointer;
    color: inherit;
    font-size: 13px;
    line-height: 1;
    vertical-align: middle;
}

.Ai-Message-Toolbar .Ai-Feedback-Btn:hover:not(:disabled) {
    opacity: 1;
    background: rgba(0, 0, 0, 0.04);
}

.Ai-Message-Toolbar .Ai-Feedback-Btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.Ai-Message-Toolbar .Ai-Feedback-Btn.is-active {
    opacity: 1;
    border-color: var(--Theme-AccentColor, #2f6fed);
    background: rgba(47, 111, 237, 0.1);
}

.Ai-Message-Toolbar .Ai-Feedback-BtnIcon {
    width: 14px;
    height: 14px;
    max-width: 14px;
    max-height: 14px;
    display: block;
    pointer-events: none;
    opacity: 0.85;
}

.Ai-Assistant-Turn {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.Ai-Assistant-ErrorDetails {
    margin-top: 8px;
    border-inline-start: 2px solid var(--Theme-WarningColor, #c57b00);
    padding-inline-start: 10px;
}

.Ai-Assistant-ErrorDetails-Header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    padding: 2px 0;
    background: transparent;
    color: var(--Theme-WarningColor, #a76000);
    cursor: pointer;
    font: inherit;
}

.Ai-Assistant-ErrorDetails-Body {
    max-height: 260px;
    overflow: auto;
    margin: 6px 0 0;
    padding: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    direction: ltr;
    text-align: left;
    background: var(--Theme-PanelBackground, #f7f9fc);
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 4px;
    font-family: Consolas, monospace;
    font-size: 12px;
}

.Ai-PlanCard-Focus {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 0 2px;
}

.Ai-PlanCard-FocusTitle {
    font-size: 13px;
    font-weight: 500;
}

.Ai-Welcome-Prompt {
    font-size: 15px;
    font-weight: 500;
    margin-top: 4px;
}

.Ai-Welcome-Starters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 720px;
    margin-top: 12px;
}

.Ai-Welcome-Starter {
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    background: var(--Theme-PanelBackground, #f7f9fc);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.Ai-Welcome-Starter:hover,
.Ai-Welcome-Starter:focus-visible {
    border-color: var(--Theme-AccentColor, #2f6fed);
    background: rgba(47, 111, 237, 0.08);
    outline: 2px solid var(--Theme-AccentColor, #2f6fed);
    outline-offset: 2px;
}

.Ai-ProseWidth {
    width: 100%;
}

.Ai-Message-Markdown {
    white-space: normal;
}

.Ai-Message-Markdown .Ai-Md-P {
    margin: 0 0 0.75em;
}

.Ai-Message-Markdown .Ai-Md-H {
    margin: 1em 0 0.4em;
    font-weight: 600;
    line-height: 1.35;
}

.Ai-Message-Markdown .Ai-Md-Ul {
    margin: 0.4em 0 0.8em;
    padding-inline-start: 1.4em;
}

.Ai-Message-Markdown .Ai-Md-Li {
    margin: 0.2em 0;
}

.Ai-Message-Markdown .Ai-Md-Hr {
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    margin: 1em 0;
}

.Ai-Message-Markdown .Ai-Md-Inline,
.Ai-Message-Markdown .Ai-Md-Code code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
}

.Ai-Message-Markdown .Ai-Md-Inline {
    padding: 0.1em 0.35em;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
}

.Ai-Message-Markdown .Ai-Md-Code {
    margin: 0.6em 0;
    padding: 0.75em;
    overflow: auto;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    direction: ltr;
    text-align: left;
}

.Ai-Message-Markdown .Ai-Md-Link {
    color: var(--Theme-AccentColor, #2f6fed);
    text-decoration: underline;
}

.Ai-Card-Summary {
    max-height: 7.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    white-space: pre-wrap;
}

.Ai-StructuredWidth {
    max-width: min(100%, 72rem);
    width: 100%;
}

.Ai-InlineExecution {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 12px 12px;
}

.Ai-Welcome-Attribution {
    font-size: 12px;
    opacity: 0.65;
    margin-top: 2px;
    margin-bottom: 8px;
}

.Ai-WorkStatus {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 10px 0;
    margin-block: 8px;
}

.Ai-RuntimePillWrap {
    margin: 0 12px 8px;
    position: relative;
}

.Ai-RuntimePill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    background: var(--Theme-PanelBackground, #f7f9fc);
    color: var(--Theme-TextColor, #243447);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.Ai-RuntimePill.is-recovering {
    border-color: #d4a017;
    background: #fff8e8;
}

.Ai-RuntimePill-Dot {
    font-size: 11px;
    line-height: 1;
}

.Ai-RuntimePanel {
    margin-top: 6px;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 10px;
    background: var(--Theme-PanelBackground, #fff);
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(20, 40, 70, 0.08);
}

.Ai-RuntimePanel-Title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.Ai-RuntimePanel-Item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 4px 0;
}

.Ai-RuntimePanel-ItemTitle {
    font-size: 12px;
    font-weight: 600;
}

.Ai-RuntimePanel-ItemDetail {
    font-size: 11px;
    opacity: 0.75;
    margin-top: 2px;
}

.Ai-RuntimePanel-Empty {
    font-size: 12px;
    opacity: 0.8;
}

.Ai-Activity-ErrorToggle {
    margin-top: 4px;
    margin-inline-start: 22px;
    border: 0;
    background: transparent;
    color: #a94442;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}

.Ai-Activity-ErrorDetails {
    margin-inline-start: 22px;
    margin-top: 4px;
    padding: 8px 10px;
    border-radius: 8px;
    /* background: #fff5f5; */
    /* border: 1px solid #f0d0d0; */
    font-size: 12px;
    line-height: 1.45;
}

.Ai-WorkStatus-Current {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.Ai-WorkStatus-Body {
    flex: 1 1 auto;
    min-width: 0;
}

.Ai-WorkStatus-Title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.Ai-WorkStatus-Detail {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 2px;
    line-height: 1.4;
}

.Ai-WorkStatus-HistoryToggle {
    display: inline-flex;
    margin-top: 6px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--Theme-MutedTextColor, #6b7a90);
    cursor: pointer;
    font-size: 12px;
}

.Ai-ActivityGroups {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.Ai-ActivityGroup-Header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: start;
}

.Ai-ActivityGroup-Summary {
    flex: 1 1 auto;
    font-size: 13px;
    font-weight: 600;
}

.Ai-ActivityGroup-Chevron {
    opacity: .5;
    font-size: 12px;
}

.Ai-ActivityGroup-Items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-inline-start: 22px;
    margin-bottom: 4px;
}

.Ai-ActivityGroup-Item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--Theme-MutedTextColor, #5a6b80);
}

.Ai-MultiAgent-Indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 6px;
    padding: 2px 4px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
    color: inherit;
}

.Ai-MultiAgent-Indicator:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--Theme-AccentColor, #3978d6) 6%, transparent);
}

.Ai-MultiAgent-IndicatorIcon {
    opacity: .7;
}

.Ai-MultiAgent-Overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    background: color-mix(in srgb, #0b1220 35%, transparent);
}

.Ai-MultiAgent-Form {
    width: min(420px, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--Theme-PanelBackground, #fff);
    border-inline-start: 1px solid var(--Theme-BorderColor, #d7dde5);
    box-shadow: -8px 0 24px rgba(20, 40, 70, 0.12);
}

.Ai-MultiAgent-FormHeader {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--Theme-BorderColor, #e5eaf0);
}

.Ai-MultiAgent-FormTitle {
    flex: 1 1 auto;
    font-weight: 700;
    font-size: 14px;
}

.Ai-MultiAgent-Close {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    opacity: .6;
}

.Ai-MultiAgent-Body {
    flex: 1 1 auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}

.Ai-MultiAgent-Node {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: start;
    color: inherit;
    font: inherit;
}

.Ai-MultiAgent-Node.is-selected,
.Ai-MultiAgent-Node:hover {
    border-color: var(--Theme-BorderColor, #d7dde5);
    background: var(--Theme-PanelBackground, #f7f9fc);
}

.Ai-MultiAgent-NodeTitle {
    font-weight: 600;
    font-size: 13px;
}

.Ai-MultiAgent-NodeActivity,
.Ai-MultiAgent-NodeSummary,
.Ai-MultiAgent-DetailActivity,
.Ai-MultiAgent-DetailSummary {
    font-size: 12px;
    color: var(--Theme-MutedTextColor, #5a6b80);
    margin-top: 2px;
}

.Ai-MultiAgent-NodeDuration {
    font-size: 11px;
    opacity: .6;
    margin-inline-start: auto;
}

.Ai-MultiAgent-Detail {
    margin-top: 8px;
    padding: 10px;
    border-top: 1px solid var(--Theme-BorderColor, #e5eaf0);
}

.Ai-MultiAgent-DetailTitle {
    font-weight: 700;
}

.Ai-MultiAgent-DetailStatus {
    font-size: 11px;
    opacity: .65;
    margin-top: 2px;
}

.Ai-TechDetails {
    opacity: .85;
    font-size: 12px;
}

/* Plan / Act operating-mode switch (compact, VS-Code-like) */
.Ai-ModeSwitch {
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 8px;
    background: var(--Theme-PanelBackground, #f7f9fc);
    padding: 2px;
    gap: 2px;
    cursor: pointer;
    min-height: 32px;
    color: var(--Theme-TextColor, #243447);
}

.Ai-ModeSwitch-Option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    opacity: 0.55;
    transition: background-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.Ai-ModeSwitch.is-plan .Ai-ModeSwitch-Plan {
    opacity: 1;
    background: #fff4e0;
    color: #8a5a00;
    border: 1px solid #e0b85a;
}

.Ai-ModeSwitch.is-act .Ai-ModeSwitch-Act {
    opacity: 1;
    background: color-mix(in srgb, var(--Theme-AccentColor, #2f6fed) 14%, transparent);
    color: var(--Theme-AccentColor, #2f6fed);
    border: 1px solid color-mix(in srgb, var(--Theme-AccentColor, #2f6fed) 45%, transparent);
}

.Ai-ModeSwitch:focus-visible {
    outline: 2px solid var(--Theme-AccentColor, #2f6fed);
    outline-offset: 2px;
}

.Ai-ModelSelector {
    box-sizing: border-box;
}

/* Keep model selection inside the white composer, at its trailing edge.
   The input box uses row-reverse so this stays opposite the voice actions.
   This is intentionally borderless: the composer itself provides the field chrome. */
.Ai-Input-ModelSelector {
    flex: 0 1 auto;
    width: max-content;
    min-width: 0;
    max-width: min(32vw, 260px);
    height: 30px;
    align-self: center;
    color: #374151;
    border-color: white !important;
}

.Ai-Input-ModelSelector > .TOrientation-Horizontal,
.Ai-Input-ModelSelector > .TextContainer {
    flex: 0 1 auto;
    min-width: 0;
}

.Ai-Input-ModelSelector > .TextContainer,
.Ai-Input-ModelSelector > .TextContainer > .TImageContentControl {
    background: transparent;
    color: inherit;
}

.Ai-Input-ModelSelector .TextPart {
    width: auto;
    min-width: 0;
    padding-inline: 0;
}

.Ai-Input-ModelSelector .TTextEdit-ButtonContainer {
    padding-inline-start: 2px;
}

.Ai-Input-ModelSelector .TTextEdit-ButtonContainer > .TButton {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding-inline: 2px;
}

@media (max-width: 640px) {
    .Ai-Input-ModelSelector {
        max-width: 40vw;
    }
}

.Ai-ToolCard {
    /* border-inline-start: 3px solid var(--Theme-BorderColor, #9aa7b8); */
}

.Ai-ToolRows {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 2px 0 8px;
    width: 100%;
    max-width: min(100%, 52rem);
}

/* Cline-like: flat tool rows — no white card chrome */
.Ai-ToolRow {
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.AI-MessageRow.AI-Tool {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.Ai-ToolRow-Shell,
.Ai-ToolRow-Card {
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    margin: 0;
    max-width: min(100%, 52rem);
    box-shadow: none;
}

.AI-Tool .Ai-ToolRow-Shell,
.AI-Tool .Ai-ToolRow-Card {
    margin-inline-start: 0;
}

.Ai-ToolRow-Header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 3px 4px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    text-align: start;
    color: inherit;
    font: inherit;
    min-height: 22px;
}

.Ai-ToolRow-Header:hover {
    background: color-mix(in srgb, var(--Theme-AccentColor, #2f6fed) 5%, transparent);
}

.Ai-ToolRow-Title {
    flex: 1;
    min-width: 0;
    opacity: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.Ai-Activity-Running .Ai-ToolRow-Title,
.Ai-Activity-Recovering .Ai-ToolRow-Title,
.Ai-Activity-Retrying .Ai-ToolRow-Title {
    opacity: 0.95;
    font-weight: 500;
}

.Ai-Activity-Completed .Ai-ToolRow-Title,
.Ai-Activity-Canceled .Ai-ToolRow-Title {
    opacity: 1;
}

.Ai-Activity-Failed .Ai-ToolRow-Title {
    opacity: 0.9;
    color: #b42318;
}

.Ai-Activity-Icon {
    font-size: 11px;
    width: 1em;
    flex-shrink: 0;
    opacity: 0.75;
    text-align: center;
}

.Ai-ToolRow-Path {
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    opacity: 0.55;
    direction: ltr;
    text-align: left;
    word-break: break-all;
    padding-inline-start: 2px;
}

.Ai-ToolRow-Code {
    margin: 2px 0 0;
    padding: 8px 10px;
    border-radius: 4px;
    background: color-mix(in srgb, #0f172a 88%, transparent);
    color: #e2e8f0;
    font-size: 11px;
    line-height: 1.45;
    overflow: auto;
    max-height: 220px;
    white-space: pre-wrap;
    word-break: break-word;
}

.Ai-ToolRow-Code-Sql {
    border-inline-start: 2px solid #5b8def;
}

.Ai-ToolRow-KindIcon {
    opacity: 0.45;
    font-size: 11px;
    width: 1em;
    text-align: center;
    flex-shrink: 0;
}

.Ai-ToolRow-Kind {
    display: none; /* Cline: single title line, no duplicate kind chip */
}

.Ai-ToolRow-Error {
    font-size: 12px;
    color: #b42318;
    line-height: 1.4;
}

/* Soft kind cue via chevron/icon tint only — no card side-bar chrome */
.Ai-ToolRow-sql,
.Ai-ToolRow-search,
.Ai-ToolRow-read,
.Ai-ToolRow-skill,
.Ai-ToolRow-write,
.Ai-ToolRow-verify,
.Ai-ToolRow-research,
.Ai-ToolRow-image,
.Ai-ToolRow-command,
.Ai-ToolRow-browser,
.Ai-ToolRow-mcp,
.Ai-ToolRow-error,
.Ai-ToolRow-subagent,
.Ai-ToolRow-tool,
.Ai-ToolRow-status {
    border-inline-start: 0;
}

.Ai-Error-Banner {
    border-color: color-mix(in srgb, #b42318 35%, var(--Theme-BorderColor, #d7dde5));
    background: color-mix(in srgb, #b42318 8%, var(--Theme-PanelBackground, #fafbfd));
}


.Ai-ToolRow-Chevron {
    opacity: 0.4;
    font-size: 10px;
    width: 0.9em;
    flex-shrink: 0;
    text-align: center;
}

.Ai-ToolRow-Body {
    padding: 2px 4px 6px 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.Ai-ToolRow-Detail {
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.4;
    white-space: pre-wrap;
}

.Ai-ToolRow-Code-Read {
    background: color-mix(in srgb, #1e293b 88%, transparent);
}

.Ai-ToolRow-Code-Write {
    background: color-mix(in srgb, #14532d 78%, #0f172a);
}

.Ai-ToolRow-Code-Command {
    background: color-mix(in srgb, #134e4a 80%, #0f172a);
}

.Ai-ToolRow-Code-Mcp {
    background: color-mix(in srgb, #581c87 75%, #0f172a);
}

.Ai-ToolRow-Code-Error {
    background: color-mix(in srgb, #7f1d1d 80%, #0f172a);
}

.Ai-ToolRow-ErrorBanner {
    font-size: 12.5px;
    font-weight: 600;
    color: #b91c1c;
    margin-bottom: 4px;
}

.Ai-ToolRow-Path-Command::before {
    content: "$ ";
    opacity: 0.7;
}

.Ai-VirtSpacer {
    width: 100%;
    pointer-events: none;
    flex-shrink: 0;
}

.Ai-SubAgent-Card,
.Ai-SubAgent-Shell {
    background: transparent;
}

.Ai-SubAgent-Body {
    gap: 6px;
}

.Ai-SubAgent-Summary {
    opacity: 0.9;
}

.Ai-SubAgent-Duration {
    flex: 0 0 auto;
    margin-inline-start: auto;
}

.Ai-SubAgent-OpenDetails {
    align-self: flex-start;
    margin-top: 4px;
    padding: 4px 10px;
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 6px;
    background: transparent;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    color: inherit;
}

.Ai-SubAgent-OpenDetails:hover {
    background: color-mix(in srgb, #d97706 12%, transparent);
}

/* Multi-agent workflow (MAF DevUI-style): one inline container per turn, emphasis only while running */
.Ai-AgentFlow-Header,
.Ai-AgentCard-Header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 3px 4px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    text-align: start;
    color: inherit;
    font: inherit;
    min-height: 22px;
}

.Ai-AgentFlow-Header:hover,
.Ai-AgentCard-Header:hover {
    background: color-mix(in srgb, var(--Theme-AccentColor, #2f6fed) 5%, transparent);
}

.Ai-AgentFlow-Title {
    font-weight: 500;
}

.Ai-AgentFlow-Count,
.Ai-AgentCard-Duration {
    flex: 0 0 auto;
    margin-inline-start: auto;
    font-size: 11px;
    opacity: 0.6;
}

.Ai-AgentFlow-Status,
.Ai-AgentCard-Status {
    width: 1em;
    flex-shrink: 0;
    text-align: center;
    font-size: 11px;
    opacity: 0.75;
}

.Ai-AgentFlow-Active .Ai-AgentFlow-Status,
.Ai-AgentCard-Active > .Ai-AgentCard-Header .Ai-AgentCard-Status {
    color: var(--Theme-AccentColor, #2f6fed);
    opacity: 1;
}

.Ai-AgentFlow-Body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px 6px 20px;
}

.Ai-AgentCard {
    border-inline-start: 2px solid color-mix(in srgb, var(--Theme-BorderColor, #d7dde5) 80%, transparent);
    padding-inline-start: 6px;
    transition: border-color var(--Ai-Motion-Normal) ease;
}

.Ai-AgentCard-Active {
    border-inline-start-color: var(--Theme-AccentColor, #2f6fed);
}

.Ai-AgentCard-Active > .Ai-AgentCard-Header .Ai-AgentCard-Name {
    font-weight: 600;
}

.Ai-AgentCard-Completed,
.Ai-AgentCard-Pending,
.Ai-AgentCard-Canceled {
    opacity: 0.85;
}

.Ai-AgentCard-Failed {
    border-inline-start-color: color-mix(in srgb, #b42318 55%, transparent);
}

.Ai-AgentCard-Failed > .Ai-AgentCard-Header .Ai-AgentCard-Status {
    color: #b42318;
}

.Ai-AgentCard-Name {
    flex: 0 1 auto;
    white-space: nowrap;
    font-weight: 500;
}

.Ai-AgentCard-Summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.7;
}

.Ai-AgentCard-Summary::before {
    content: "— ";
}

.Ai-AgentCard-Chevron {
    opacity: 0.4;
    font-size: 10px;
    width: 0.9em;
    flex-shrink: 0;
    text-align: center;
}

.Ai-AgentCard-Handoff {
    font-size: 11px;
    opacity: 0.6;
    padding: 2px 4px 0;
}

.Ai-AgentCard-Body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px 4px 20px;
}

.Ai-AgentCard-Current {
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.4;
}

.Ai-AgentCard-Steps {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.Ai-AgentCard-Step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    min-height: 20px;
}

.Ai-AgentCard-StepTitle {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.85;
}

.Ai-AgentCard-StepError {
    padding-inline-start: 1.6em;
}

.Ai-AgentCard-TechToggle {
    align-self: flex-start;
    margin-top: 2px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 11px;
    opacity: 0.55;
    cursor: pointer;
    text-decoration: underline dotted;
}

.Ai-AgentCard-Tech {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 1px 10px;
    margin: 2px 0 0;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    opacity: 0.7;
}

.Ai-AgentCard-Tech dt {
    font-weight: 600;
}

.Ai-AgentCard-Tech dd {
    margin: 0;
    word-break: break-all;
}

.Ai-ToolRow-Path-File::before {
    content: "☰ ";
    opacity: 0.7;
}

.Ai-ToolRow-Path-Url::before {
    content: "↗ ";
    opacity: 0.7;
}

.Ai-ToolRow-Path-Search::before {
    content: "⌕ ";
    opacity: 0.7;
}

.Ai-ToolRow-SkillBadge {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: color-mix(in srgb, #c084fc 22%, transparent);
    color: inherit;
}

.Ai-ToolRow-Target {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

.Ai-ToolRow-SearchBody,
.Ai-ToolRow-VerifyBody,
.Ai-ToolRow-ResearchBody,
.Ai-ToolRow-StatusBody {
    font-size: 12.5px;
    line-height: 1.45;
}

.Ai-ToolRow-Meta {
    font-size: 11px;
    opacity: 0.55;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.Ai-ToolCard-Label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 2px;
    letter-spacing: 0.01em;
}

.Ai-Activity-TitleWrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.Ai-Activity-Summary {
    font-size: 11px;
    opacity: 0.7;
    line-height: 1.35;
}

.Ai-ActivityTree-Compact {
    margin-top: 8px;
    border: 0;
    background: transparent;
    padding: 0;
}

.Ai-ActivityTree-Compact .Ai-ActivityNode {
    padding-block: 4px;
}

.Ai-ActivityTree-Compact .Ai-Activity-Title {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
}

.Ai-PlanCard,
.Ai-ActivityTree,
.Ai-GeneratedCard,
.Ai-Approval-Card,
.Ai-ResumeCard,
.Ai-DiagnosticPanel {
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    border-radius: 10px;
    background: var(--Theme-PanelBackground, #fafbfd);
    padding: 10px 12px;
}

.Ai-PlanCard-Header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: start;
    padding: 0;
    color: inherit;
}

.Ai-PlanCard-Label {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 600;
}

.Ai-PlanCard-Title {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 13px;
}

.Ai-PlanCard-Progress {
    font-size: 12px;
    opacity: 0.75;
    direction: ltr;
    unicode-bidi: isolate;
}

.Ai-PlanCard-Steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    max-height: min(42vh, 360px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-inline-end: 2px;
}

.Ai-PlanCard-Step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
}

.Ai-PlanCard-Icon {
    width: 1.1em;
    text-align: center;
    flex: 0 0 auto;
}

.Ai-PlanStep-Running .Ai-PlanCard-Icon,
.Ai-Activity-Running .Ai-Activity-Icon {
    color: var(--Theme-AccentColor, #2f6fed);
}

.Ai-PlanStep-Completed .Ai-PlanCard-Icon,
.Ai-Activity-Completed .Ai-Activity-Icon {
    color: #2e7d32;
}

.Ai-PlanStep-Failed .Ai-PlanCard-Icon,
.Ai-Activity-Failed .Ai-Activity-Icon {
    color: #c62828;
}

.Ai-PlanStep-Waiting .Ai-PlanCard-Icon,
.Ai-Activity-WaitingForUser .Ai-Activity-Icon,
.Ai-Activity-WaitingForConfirmation .Ai-Activity-Icon {
    color: #ef6c00;
}

.Ai-ActivityNode-Row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.Ai-Activity-Title {
    font-size: 13px;
    font-weight: 500;
}

.Ai-Activity-Detail {
    font-size: 12px;
    opacity: 0.75;
}

.Ai-Activity-DetailsBtn,
.Ai-PlanCard-ExpandStep,
.Ai-Feedback-Btn,
.Ai-Citation-Chip,
.Ai-Card-Action,
.Ai-Recovery-ReviewButton {
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    background: transparent;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    color: inherit;
}

.Ai-Feedback-Btn.is-active {
    border-color: var(--Theme-AccentColor, #2f6fed);
    background: rgba(47, 111, 237, 0.1);
}

.Ai-Approval-Card {
    border-inline-start: 3px solid #ef6c00;
}

.Ai-Approval-Title {
    font-weight: 600;
    margin-bottom: 6px;
}

.Ai-Approval-Body {
    /* Mixed Persian + code: keep source LTR so braces/semicolons are not mirrored. */
    direction: ltr;
    unicode-bidi: plaintext;
    text-align: start;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 220px;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
}

.Ai-Approval-Consequence {
    font-size: 12px;
    opacity: 0.85;
    margin: 8px 0;
}

.Ai-Approval-Actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
}

.Ai-Approval-Always {
    opacity: 0.95;
}

.Ai-Card-Metrics {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    margin: 8px 0;
}

.Ai-Card-MetricLabel { font-size: 13px; }
.Ai-Card-MetricValue {
    font-weight: 600;
    direction: ltr;
    unicode-bidi: isolate;
}

.Ai-Card-Table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.Ai-Card-Table th,
.Ai-Card-Table td {
    border: 1px solid var(--Theme-BorderColor, #d7dde5);
    padding: 4px 6px;
    text-align: start;
}

.Ai-Card-Actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.Ai-Citations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.Ai-Code-Block {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
}

.Ai-ResponseBlock-Host {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.Ai-SafeHtml {
    overflow: auto;
    max-width: 100%;
}

.Ai-SafeHtml table {
    border-collapse: collapse;
    width: 100%;
}

.Ai-SafeHtml th,
.Ai-SafeHtml td {
    border: 1px solid var(--Theme-BorderColor, #ddd);
    padding: 6px 8px;
}

.Ai-ResponseBlock-CodePre {
    margin: 0;
    padding: 10px 12px;
    max-height: 420px;
    overflow: auto;
    background: var(--Theme-SurfaceAlt, #f6f7f9);
    border: 1px solid var(--Theme-BorderColor, #ddd);
    border-radius: 4px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    white-space: pre;
}

.Ai-ResponseBlock-Image img,
.Ai-ResponseBlock-Video {
    max-width: 100%;
    border-radius: 6px;
}

.Ai-ResponseBlock-ImageSvg img {
    background:
        linear-gradient(45deg, #eceff3 25%, transparent 25%),
        linear-gradient(-45deg, #eceff3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eceff3 75%),
        linear-gradient(-45deg, transparent 75%, #eceff3 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.Ai-ToolRow-ImageGen {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 2px;
}

.Ai-ToolRow-ImageGen-Canvas {
    position: relative;
    width: min(180px, 100%);
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--Theme-BorderColor, #d7dde5) 80%, transparent);
    background: linear-gradient(145deg, #1a2433 0%, #2a3a4f 45%, #1e2b3c 100%);
}

.Ai-ToolRow-ImageGen-Shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 20%,
        rgba(255, 255, 255, 0.12) 45%,
        transparent 70%);
    background-size: 220% 100%;
    animation: AiChat-ImageGenShimmer 1.8s ease-in-out infinite;
}

.Ai-ToolRow-ImageGen-Orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0.55;
    animation: AiChat-ImageGenFloat 2.4s ease-in-out infinite;
}

.Ai-ToolRow-ImageGen-Orb-a {
    width: 34%;
    height: 34%;
    left: 18%;
    top: 22%;
    background: radial-gradient(circle, #7ec8ff 0%, transparent 70%);
}

.Ai-ToolRow-ImageGen-Orb-b {
    width: 28%;
    height: 28%;
    right: 16%;
    bottom: 20%;
    background: radial-gradient(circle, #9b8cff 0%, transparent 70%);
    animation-delay: 0.4s;
}

.Ai-ToolRow-ImageGen-Orb-c {
    width: 18%;
    height: 18%;
    left: 48%;
    top: 48%;
    background: radial-gradient(circle, #ffd27a 0%, transparent 70%);
    animation-delay: 0.9s;
}

.Ai-ToolRow-ImageGen-Frame {
    position: absolute;
    inset: 10px;
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

.Ai-ToolRow-ImageGen-Label {
    font-size: 12px;
    opacity: 0.9;
}

.Ai-ToolRow-ImageGen.is-failed .Ai-ToolRow-ImageGen-Canvas {
    background: linear-gradient(145deg, #3a2222 0%, #4a2a2a 100%);
}

.Ai-ToolRow-ImageGen:not(.is-running) .Ai-ToolRow-ImageGen-Shimmer,
.Ai-ToolRow-ImageGen:not(.is-running) .Ai-ToolRow-ImageGen-Orb {
    animation: none;
}

@keyframes AiChat-ImageGenShimmer {
    0% { background-position: 120% 0; }
    100% { background-position: -40% 0; }
}

@keyframes AiChat-ImageGenFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.45; }
    50% { transform: translateY(-6px) scale(1.08); opacity: 0.75; }
}

.Ai-ResponseBlock-Audio {
    width: 100%;
}

.Ai-ResponseBlock-Fallback {
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(180, 80, 40, 0.08);
    color: var(--Theme-DangerColor, #a33);
}

.Ai-ResponseBlock-FieldHint {
    display: block;
    opacity: 0.75;
    font-size: 12px;
    margin-top: 2px;
}

.Ai-ResponseBlock-Caption {
    font-size: 13px;
    opacity: 0.85;
}

.Ai-Message-Markdown .Ai-Md-Ol .Ai-Md-Ul,
.Ai-Message-Markdown .Ai-Md-Ul .Ai-Md-Ol,
.Ai-Message-Markdown .Ai-Md-Ul .Ai-Md-Ul,
.Ai-Message-Markdown .Ai-Md-Ol .Ai-Md-Ol {
    margin-top: 4px;
    margin-bottom: 4px;
}

.Ai-VisuallyHidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.Ai-DiagnosticPanel {
    margin: 8px 12px;
    font-size: 12px;
}

.Ai-DiagnosticBody,
.Ai-Activity-Tech {
    font-family: Consolas, "Courier New", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.Ai-ResumePrimary {
    border-color: var(--Theme-AccentColor, #2f6fed);
    background: rgba(47, 111, 237, 0.1);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .Ai-Welcome-Starter,
    .Ai-PlanCard-Header,
    .Ai-Feedback-Btn,
    .Ai-ToolRow-ImageGen-Shimmer,
    .Ai-ToolRow-ImageGen-Orb {
        transition: none !important;
        animation: none !important;
    }
}

@media (prefers-contrast: more) {
    .Ai-PlanCard,
    .Ai-ActivityTree,
    .Ai-GeneratedCard,
    .Ai-Approval-Card {
        border-width: 2px;
    }
    .Ai-PlanCard-Icon,
    .Ai-Activity-Icon {
        font-weight: 700;
    }
}
/*#endregion*/
