/* Echo Chat dedicated stylesheet.
   Extracted from echo.css for maintainability. */

/* ── 대화 이력 슬라이드 (Copilot식) ──────────────────────────────────
   기준점은 .echo-chat-host(position:relative). 드로어는 absolute + translateX로
   어시스턴트 컨테이너 왼쪽에서 슬라이드한다. host에 overflow:hidden을 줘서 닫힌
   상태의 드로어가 컨테이너 밖으로 삐져나가지 않게 클리핑한다. */
.echo-chat-host {
    overflow: hidden;
}

.echo-history-scrim {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(22, 22, 22, 0.28);
    animation: echoHistoryScrimIn 160ms ease-out;
}

@keyframes echoHistoryScrimIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.echo-history-drawer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 86%;
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: var(--cds-bg-light);
    border-right: 1px solid var(--cds-border-subtle-01, #e0e0e0);
    box-shadow: 2px 0 14px rgba(15, 23, 42, 0.14);
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.2, 0, 0.2, 1);
    will-change: transform;
    visibility: hidden; /* 슬라이드 닫혔을 때 box-shadow 안보이게 처리 */
}

.echo-history-drawer.is-open {
    transform: translateX(0);
    visibility: visible; 
}

.echo-history-drawer.is-open ~ .dock-bottom .request-content {
    display: none !important;
}

.echo-history-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 8px 0 16px;
    border-bottom: 1px solid var(--cds-border-subtle-01, #e0e0e0);
}

.echo-history-drawer__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--cds-text-primary);
}

.echo-history-drawer__new {
    display: flex;
    align-items: center;
    width: calc(100% - 24px);
    margin: 12px;
    padding: 8px 12px;
    border: 1px solid var(--echo-blue-60, #0f62fe);
    border-radius: 8px;
    background: #ffffff;
    color: var(--echo-blue-60, #0f62fe);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 140ms ease;
}

.echo-history-drawer__new:hover {
    background: #edf4ff;
}

.echo-history-drawer__list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 12px;
}

.echo-history-drawer__empty {
    padding: 24px 12px;
    color: var(--echo-gray-60, #525252);
    font-size: 13px;
    text-align: center;
}

/* V2-C7 파일럿: 에코 봇 고정 채널 — 일반 대화와 시각적으로 구분되는 상단 고정 항목 */
.echo-bot-channel {
    border: 1px solid var(--echo-gray-20, #e0e0e0);
    background: var(--echo-gray-10, #f4f4f4);
    margin-bottom: 8px;
}

.echo-bot-channel .carbon-icon {
    color: var(--echo-blue-60, #0f62fe);
}

.echo-bot-channel.is-active {
    border-color: var(--echo-blue-60, #0f62fe);
}

.echo-history-drawer__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 32px 10px 12px;
    margin-bottom: 2px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: background 120ms ease;
}
.echo-history-drawer__item-wrap:hover .cds-popover-wrap {
    display: block !important;
}

.echo-history-drawer__list .cds-popover-wrap {
    position: absolute;
    top: 6px;
    right: 0;
}


.echo-history-drawer__item:hover {
    background: var(--echo-gray-10, #f4f4f4);
}

.echo-history-drawer__item.is-active {
    background: var(--cds-background-active);
}

.echo-history-drawer__item-top {
    display: flex;
    align-items: center;
    gap: 4px;
}

.echo-history-drawer__item-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--cds-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.echo-history-drawer__item-time {
    flex: none;
    font-size: 11px;
    color: var(--cds-text-secondary);
}

.echo-history-drawer__item-preview {
    margin-top: 2px;
    font-size: 12px;
    color: var(--cds-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
    .echo-history-drawer {
        transition: none;
    }

    .echo-history-scrim {
        animation: none;
    }
}

/* MCP progress state */
.thinking-text-container.mcp-progress-running {
    border-color: #b8b8b8 !important;
}

.thinking-text-container.mcp-progress-done {
    border-color: #24a148 !important;
    background-color: #f3fff6;
    display:none;
}

/* Echo v2 host theme (Carbon + Gemini tone) */
.echo-chat-host {
    --echo-blue-60: #0f62fe;
    --echo-blue-70: #0043ce;
    --echo-gray-10: #f4f4f4;
    --echo-gray-20: #e0e0e0;
    --echo-gray-30: #c6c6c6;
    --echo-gray-60: #525252;
    --echo-gray-80: #393939;
    --echo-user-bubble-bg: linear-gradient(135deg, #edf5ff 0%, #dbe9ff 100%);
    --echo-assistant-bubble-bg: #ffffff;
    --echo-bubble-border: #d0d7e2;
    --echo-thinking-bg: #f8f9fb;
    --echo-orch-planner-bg: #fff4de;
    --echo-orch-planner-border: #f1c98b;
    --echo-orch-execute-bg: #edf4ff;
    --echo-orch-execute-border: #b8d3ff;
    --echo-orch-done-border: #24a148;
    --echo-orch-error-bg: #fff1f1;
    --echo-orch-error-border: #da1e28;
    --echo-code-bg: #161616;
    --echo-code-border: #393939;
    --echo-code-text: #f4f4f4;
    background: radial-gradient(1200px 520px at 100% 0%, #edf4ff 0%, #f8fbff 45%, #ffffff 100%);
}



/* ====================================
   Echo Window
   ==================================== */
.echo-ai-window {
    border-radius: 16px !important;
/*    overflow: visible !important;*/
    border: 1px solid var(--cds-gray-400);
}
[data-bs-theme=light] .echo-ai-window {
    box-shadow: rgba(255, 255, 255, 0.22) 0px 0px 2px 0px inset, rgba(255, 255, 255, 0.18) 0px 0px 4px 1px, rgb(255 255 255 / 35%) 0px 0px 6px 4px, rgba(255, 255, 255, 0.12) 0px 0px 80px 12px !important;
}

[data-bs-theme=dark] .echo-ai-window {
    box-shadow: rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset, rgba(0, 0, 0, 0.05) 0px 0px 2px 1px, rgba(0, 0, 0, 0.3) 0px 12px 30px !important;
}

/* rwwindow에서 ai 배경색상 안나옴 해결 */
.echo-ai-window .rw-window-content,
.echo-ai-window .echo-chat-host .chat-content-root {
    background: transparent !important;
    border-radius: 16px !important;
}


[data-bs-theme=light] .echo-ai-window .ai-bg {
    background: linear-gradient(180deg, rgba(38, 38, 38, 0) 0%, rgba(38, 38, 38, 0) 50%, rgb(174 204 255 / 16%) 70%, rgb(148 187 255 / 28%) 100%);
}

[data-bs-theme=dark] .echo-ai-window .ai-bg {
    background: linear-gradient( 180deg, rgba(38, 38, 38, 0) 0%, rgba(38, 38, 38, 0) 50%, rgba(46, 72, 116, 0.16) 70%, rgba(74, 116, 188, 0.28) 100% );
}


/* error시 입력창 */
.echo-ai-window .request-container .request-content.failed {
    outline: 2px solid #da1e28;
    outline-offset: -2px;
}

.echo-ai-window .echo-chat-assistant .echo-chat-body-container {
    font-size: 14px !important;
}

.echo-ai-window .drag-bar-wrap {
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
}
.echo-ai-window .drag-bar {
    width: 100px;
    height: 3px;
    background-color: var(--cds-gray-500, #8d8d8d);
    border-radius: 50px;
}

/* Echo 모델 선택 영역 */
.echo-ai-window .dock-top:has(.echo-info-wrap) {
    display: flex;
    flex-direction: row;
    justify-content: center;
}
.echo-ai-window .echo-info-wrap {
    width: 95%;
    background-color: var(--cds-layer-01, #f4f4f4) !important;
    border-radius: 8px;
}

.echo-ai-window .echo-info-wrap .app-title-container {
    border: 0 !important;
}

.echo-ai-window .echo-info-wrap .dock-content {
    background: transparent !important;
}

.echo-ai-window .echo-info-wrap .cds-popover-wrap button.cds-icon-only-btn {
    border-radius: 0 8px 8px 0;
}

.echo-ai-window .thinking-text-container .echo-chat-assistant__status-text {
    padding-left: 16px !important;
}
.echo-ai-window .thinking-text-container .echo-chat-assistant__status-text.is-loading {
    padding-left: 0 !important;
}
.echo-ai-window .echo-chat-assistant__chart-block{
    padding-left: 32px !important;
    margin-top: 16px !important;
}
.echo-ai-window .echo-chart-title {
    font-weight: 600 !important;
    font-size: 14px;
    font-weight: 500;
}

.echo-ai-window .echo-chat-assistant .chat-user-container {
    padding-left: 80px !important;
}

.echo-ai-window .echo-window-header:hover .position-absolute.top-0 {
    display: block !important;
}


/* ==================================== */
.echo-chat-host .dock-content {
    /*    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 1) 30%);*/
    background-color: var(--cds-field, #ffffff);
}


.echo-chat-message-row--user {
    display: flex;
    justify-content: flex-end;
}

.echo-chat-message-row--assistant {
    display: flex;
    justify-content: flex-start;
}
.echo-chat-body-container .echo-new-chat .carbon-icon {
    background: linear-gradient(to left, #0f62feb0, #0f62fe7d 50%, #0f62fed9 75%, #0f62fe 75%) !important;
}
.echo-chat-body-container .echo-new-chat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height:220px;
}


.echo-chat-bubble {
    max-width: min(92%, 960px);
    /*    border: 1px solid var(--echo-bubble-border, #d0d7e2) !important;*/
    /*    border-radius: 12px !important;*/
}

.echo-chat-bubble.card .card-body {
    padding: 12px 14px !important;
}

.echo-chat-bubble--user {
    background-color: var(--cds-echo-bubble, #f4f4f4);
    
}

.echo-chat-bubble--assistant {
    background: var(--echo-assistant-bubble-bg, #ffffff);
}

.echo-chat-plain {
    margin: 0;
    white-space: pre-wrap;
    font-family: "IBM Plex Sans", "Pretendard Variable", "Segoe UI", sans-serif;
    color: var(--cds-text-primary, #161616);
}

.echo-response-metrics {
    margin-top: 8px;
    order: 4;
}

.echo-response-metrics__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /*    color: var(--cds-text-secondary, #525252);*/
    color: var(--text-gray-400, #9ca3af);
    font-size: 12px;
    line-height: 1.2;
}

.echo-response-metrics__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.echo-thinking-block {
    margin-bottom: 8px;
    margin-left: 16px;
    padding: 0px 10px;
    border-left: 1px solid var(--cds-border-subtle-01, #e0e0e0);
    padding-left: 16px;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.45;
    color: var(--cds-text-secondary, #525252);
}

.echo-orch-feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.echo-progress-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0 0 12px 16px;
    padding-left: 16px;
    border-left: 1px solid var(--cds-border-subtle-01, #e0e0e0);
}

.echo-progress-panel__headline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    min-height: 36px;
    padding: 7px 14px 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(114, 158, 255, 0.5);
    background: linear-gradient(135deg, rgba(15, 98, 254, 0.15) 0%, rgba(36, 99, 235, 0.08) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    color: var(--cds-text-primary, #161616);
    transition: opacity 180ms ease, transform 180ms ease, color 180ms ease;
}

.echo-progress-panel__headline.is-live .echo-progress-panel__headline-text {
    background: linear-gradient(90deg, #dbeafe 0%, #ffffff 50%, #bfdbfe 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: echoProgressTextSweep 1.6s linear infinite;
}

.echo-progress-panel__headline.is-error {
    border-color: rgba(218, 30, 40, 0.6);
    background: rgba(218, 30, 40, 0.08);
}

/* 진행 상태 텍스트(파란 생각중 문구): 기존 echoProgressTextSweep 재사용 —
   carbon blue-60 글자 위로 blue-30 밝은 밴드가 흘러가는 스윕 */
.echo-chat-assistant__status-text.is-loading {
    background: linear-gradient(90deg, #0f62fe 0%, #a6c8ff 50%, #0f62fe 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: echoProgressTextSweep 1.6s linear infinite;
}

/* --- watsonx급 진행 표시 폴리시 (2026-07-06) --- */

/* 새 진행 스텝이 아래에서 부드럽게 등장 */
.echo-chat-assistant__activity-item {
    animation: echoStepEnter 240ms ease-out;
}

@keyframes echoStepEnter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* 실행 중 스텝: 제목 앞에 carbon blue 펄스 도트 (기존 echoProgressPulse 재사용) */
.echo-chat-assistant__activity-item .thinking-text-content:has(> .echo-chat-assistant__status-text.is-loading),
.thinking-text-container.is-live .thinking-text-content {
    position: relative;
    padding-left: 18px;
}

/* 생각 중 앞에 도트 */
.echo-chat-assistant__activity-item .thinking-text-content:has(> .echo-chat-assistant__status-text.is-loading)::before,
.thinking-text-container.is-live .thinking-text-content::before {
/*    content: "";
    position: absolute;
    left: 2px;
    top: 0.55em;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #0f62fe;
    animation: echoProgressPulse 1.6s ease-out infinite;*/
}

/* 완료된 스텝은 차분한 회색으로 가라앉음 — 시선은 항상 현재 스텝에 */
.echo-chat-assistant__activity-item[data-state="Succeeded"] .echo-chat-assistant__status-text,
.echo-chat-assistant__activity-item[data-state="Completed"] .echo-chat-assistant__status-text {
    color: var(--cds-text-secondary, #525252);
    transition: color 300ms ease;
}

/* 생각 점 3개: 물결 타이밍으로 부드럽게 */
.echo-thinking-dots .echo-dot,
.echo-thinking-indicator .echo-dot {
    animation-timing-function: ease-in-out;
}

.echo-progress-panel__headline-icon {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: none;
    background: var(--echo-blue-60, #0f62fe);
    box-shadow: 0 0 0 0 rgba(15, 98, 254, 0);
}

.echo-progress-panel__headline.is-live .echo-progress-panel__headline-icon {
    animation: echoProgressPulse 1.15s ease-in-out infinite;
}

.echo-progress-panel__headline.is-error .echo-progress-panel__headline-icon {
    background: var(--echo-orch-error-border, #da1e28);
}

.echo-progress-panel__headline-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.echo-progress-panel__detail {
    padding-left: 16px;
    color: var(--cds-text-secondary, #9ca3af);
    font-size: 12px;
    line-height: 1.45;
    opacity: 0.88;
}

.echo-progress-panel__detail.is-error {
    color: var(--echo-orch-error-border, #da1e28);
}

.echo-progress-panel__detail-text {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
    letter-spacing: 0.01em;
}

.echo-progress-panel__detail.is-live .echo-progress-panel__detail-text {
    animation: echoProgressDetailFade 1.2s ease-in-out infinite;
}


.echo-orch-item {
    position: relative;
    display: block;
    padding: 4px 10px 4px 0px;
    white-space: pre-wrap;
    font-size: 0.8rem;
    line-height: 1.45;
    font-family: "IBM Plex Sans", "Pretendard Variable", "Segoe UI", sans-serif;
}
/*
.echo-orch-item::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8d8d8d;
}
*/
/*.echo-orch-item--planner {
    background: var(--echo-orch-planner-bg);
    border-color: var(--echo-orch-planner-border);
}*/


/*.echo-orch-item--running {
    box-shadow: inset 3px 0 0 var(--echo-blue-60);
}*/

/*.echo-orch-item--running::before {
    background: var(--echo-blue-60);
}*/

/*.echo-orch-item--done {
    border-color: var(--echo-orch-done-border);
    box-shadow: inset 3px 0 0 var(--echo-orch-done-border);
}*/

/*.echo-orch-item--done::before {
    background: var(--echo-orch-done-border);
}*/

.echo-orch-item--error {
    background: var(--echo-orch-error-bg);
    border-color: var(--echo-orch-error-border);
    box-shadow: inset 3px 0 0 var(--echo-orch-error-border);
}

.echo-orch-item--error::before {
    background: var(--echo-orch-error-border);
}

.echo-orch-item__text {
    display: inline;
    font-size: 12px;
    color: var(--cds-text-secondary, #525252);
}

.echo-orch-item__meta {
    display: flex;
    flex-direction: row;
    align-items: start;
    gap: 16px;
}

.echo-orch-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.echo-orch-badge--phase {
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

.echo-orch-badge--status {
    background: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.echo-orch-item__raw {
    margin-top: 4px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    color: #64748b;
    font-family: "IBM Plex Mono", "D2Coding", Consolas, monospace;
    font-size: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Planner hint: no card look, auto-hide when answer content starts rendering */
.echo-orch-item--transient {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 2px 0 2px 2px;
    font-size: 12px;
    color: #6f6f6f;
}

.echo-orch-item--transient::before {
    display: none;
}

.echo-chat-bubble--assistant.has-main-content .echo-orch-item--transient {
    display: none;
}

/* Orchestration / Thinking / Response stage controls */
.echo-chat-bubble--assistant .card-body {
    display: flex;
    flex-direction: column;
}

.echo-phase--mcp {
    order: 1;
}

.echo-phase--thinking {
    order: 2;
}

.echo-phase--response {
    order: 3;
}

.echo-phase-card {
/*    border: 1px solid var(--cds-border-subtle-01, #e0e0e0);
    background: var(--cds-field-03, #f4f4f4) !important;*/
}

.echo-phase-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    margin-left: 16px;
    padding-bottom:4px;
}

.echo-phase-card__title {
    font-size: 12px;
    color: var(--cds-text-primary, #161616);
    padding: 0px 12px;
}

.echo-phase-card__toggle {
    border: 0;
    border-radius: 20px;
    background-color: var(--cds-layer-03, #fafafa);
    padding: 0 12px;
    font-size: 12px;
    color: var(--cds-text-primary, #161616);
}
    .echo-phase-card__toggle:hover {
        background-color: var(--cds-layer-hover, #e8e8e8);
    }

    .echo-phase-card__body {
        margin-top: 8px;
        padding: 10px 14px;
        border-radius: 4px;
    }
        /* 실제 텍스트가 들어가는 div */
        .echo-phase-card__body > div {
            /* 3줄 제한 핵심 코드 */
            max-height: 4.5em; /* line-height(1.5) * 3줄 = 4.5em */
            line-height: 1.5;
            overflow-y: auto; /* 세로 스크롤 활성화 */
            font-size: 14px;
            color: var(--cds-text-secondary, #525252);
            white-space: pre-wrap; /* 줄바꿈 허용 */
            word-break: break-all;
        }

.echo-phase-card.is-collapsed .echo-phase-card__body {
    display: none;
}

.echo-phase-card.is-active .echo-phase-card__head {
    border-bottom: 0;
}

.echo-phase-card--mcp .echo-orch-feed {
    margin-bottom: 0;
}

.echo-orch-feed {
    margin-bottom: 0;
    margin-left: 16px;
    border-left: 1px solid var(--cds-border-subtle-01, #e0e0e0);
    padding-left: 16px;
}

/*.echo-chat-host.mode-normal .echo-thinking-block--preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 68px;
}
*/
.echo-chat-host.mode-normal .echo-thinking-block--preview.is-active {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-left: 1px solid var(--cds-border-subtle-01, #e0e0e0);
    padding-left: 16px;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.45;
    color: var(--cds-text-secondary, #525252);
}

.echo-chat-host.mode-debug .echo-phase--mcp,
.echo-chat-host.mode-debug .echo-phase--thinking {
    display: block;
    opacity: 1;
    max-height: none;
}

/* Markdown + code styling for Echo host */
.echo-chat-host .markdown-body {
    font-family: "IBM Plex Sans", "Pretendard Variable", "Segoe UI", sans-serif;
    color: var(--cds-text-primary, #161616);
    font-size: 14px;
    line-height: 24px;
}

.echo-chat-host .markdown-body p {
    margin-bottom: 8px;
    margin-top: 8px;
}

.echo-chat-host .markdown-body p:last-child {
    margin-top: 0;
    margin-bottom: 0;
}

.echo-chat-host .markdown-body h1,
.echo-chat-host .markdown-body h2,
.echo-chat-host .markdown-body h3,
.echo-chat-host .markdown-body h4 {
    margin-top: 8px;
    margin-bottom: 6px;
    font-family: "IBM Plex Sans", "Pretendard Variable", "Segoe UI", sans-serif;
    font-weight: 600;
}

.echo-chat-host .markdown-body ul,
.echo-chat-host .markdown-body ol {
    margin-top:8px;
    margin-bottom: 8px;
    padding-left: 1.2rem;
}


.echo-chat-host .markdown-body .table-responsive {
    margin-top: 12px;
    margin-bottom: 16px
}

.echo-chat-host .markdown-body blockquote {
    margin: 0.65rem 0;
    border-left: 3px solid var(--echo-blue-60);
    background: #f6f9ff;
    color: #374151;
    border-radius: 0 8px 8px 0;
}

.echo-chat-host .markdown-body a {
    color: var(--echo-blue-70);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.echo-chat-host .markdown-body :not(pre) > code {
    background: none;
    color: var(--cds-text-primary, #161616);
/*    border: 1px solid #d6e3ff;*/
/*    border-radius: 6px;*/
/*    padding: 0.12rem 0.38rem;*/
/*    font-family: "IBM Plex Mono", "D2Coding", Consolas, monospace;*/
    font-size: 12px;
    box-shadow: none;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.echo-chat-host .markdown-body .code-block {
    display: flex;
    flex-direction: column;
    margin: 10px 0 16px !important;
    overflow: hidden;
}

.echo-chat-host .markdown-body .code-block .code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #161616;
    color: #ffffff;
    border-top-left-radius:2px;
    border-top-right-radius:2px;
}

.echo-chat-host .markdown-body .code-block .code-header .text-muted {
    color: #ffffff !important;
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 12px;
}

.echo-chat-host .markdown-body .code-block .cds-code-body {
    background: var(--echo-code-bg) !important;
    margin: 0 !important;
    padding: 12px 10px !important;
    overflow-x: auto;
}

.echo-chat-host .markdown-body .code-block pre,
.echo-chat-host .markdown-body pre[class*="language-"] {
    background: var(--echo-code-bg) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.echo-chat-host .markdown-body .code-block code,
.echo-chat-host .markdown-body code[class*="language-"] {
    background: transparent !important;
    color: var(--echo-code-text) !important;
    font-family: "IBM Plex Mono", "D2Coding", Consolas, monospace;
    font-size: 12px;
    line-height: 1.58;
    text-shadow: none !important;
}

.echo-chat-host .markdown-body .code-block .copy-btn {
    border: 1px solid #6f6f6f;
    border-radius: 6px;
    background: transparent;
    color: #d0d0d0;
    width: 26px;
    height: 26px;
}

.echo-chat-host .markdown-body .code-block .copy-btn:hover {
    border-color: #a8a8a8;
    background: #393939;
    color: #f4f4f4;
}

.echo-chat-host .request-content .echo-chat-stop-btn {
/*    min-width: 64px;
    height: 36px;
    padding: 0 12px;*/
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1;
}

/* Prism token palette */
.echo-chat-host .markdown-body .token.comment,
.echo-chat-host .markdown-body .token.prolog,
.echo-chat-host .markdown-body .token.doctype,
.echo-chat-host .markdown-body .token.cdata {
    color: #8d8d8d;
}

.echo-chat-host .markdown-body .token.punctuation {
    color: #c6c6c6;
}

.echo-chat-host .markdown-body .token.property,
.echo-chat-host .markdown-body .token.tag,
.echo-chat-host .markdown-body .token.constant,
.echo-chat-host .markdown-body .token.symbol,
.echo-chat-host .markdown-body .token.deleted {
    color: #78a9ff;
}

.echo-chat-host .markdown-body .token.boolean,
.echo-chat-host .markdown-body .token.number {
    color: #ff8389;
}

.echo-chat-host .markdown-body .token.selector,
.echo-chat-host .markdown-body .token.attr-name,
.echo-chat-host .markdown-body .token.string,
.echo-chat-host .markdown-body .token.char,
.echo-chat-host .markdown-body .token.builtin,
.echo-chat-host .markdown-body .token.inserted {
    color: #42be65;
}

.echo-chat-host .markdown-body .token.operator,
.echo-chat-host .markdown-body .token.entity,
.echo-chat-host .markdown-body .token.url,
.echo-chat-host .markdown-body .language-css .token.string,
.echo-chat-host .markdown-body .style .token.string {
    color: #a6c8ff;
}

.echo-chat-host .markdown-body .token.atrule,
.echo-chat-host .markdown-body .token.attr-value,
.echo-chat-host .markdown-body .token.keyword {
    color: #be95ff;
}

.echo-chat-host .markdown-body .token.function,
.echo-chat-host .markdown-body .token.class-name {
    color: #08bdba;
}

.echo-chat-host .markdown-body .token.regex,
.echo-chat-host .markdown-body .token.important,
.echo-chat-host .markdown-body .token.variable {
    color: #f1c21b;
}

@media (max-width: 768px) {
    .echo-chat-bubble {
        max-width: 100%;
        border-radius: 10px !important;
    }

    .echo-chat-bubble.card .card-body {
        padding: 10px 11px !important;
    }

    .echo-chat-host .markdown-body .code-block .cds-code-body {
        padding: 0.72rem 0.75rem;
    }
}

/* V2 /echohost/general option panel */
.v2-general-page {
    background-color: var(--cds-field, #FFFFFF);
}

.v2-general-side {
    width: 430px;
    overflow: auto;
    background-color: var(--cds-field, #FFFFFF);
}

.v2-general-title {
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cds-text-primary, #161616);
}

.v2-general-subtitle {
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--cds-text-secondary, #525252);
}

.v2-general-status {
    border: 1px solid #d0d7e2;
    padding: 6px 8px;
    font-size: 12px;
    margin-bottom: 12px;
}

.v2-general-status--info {
    background: #edf5ff;
    color: #003a6d;
}

.v2-general-status--success {
    background: #edf8f1;
    color: #0e6027;
    border-color: #a7f0ba;
}

.v2-general-status--error {
    background: #fff1f1;
    color: #a2191f;
    border-color: #ffd7d9;
}

.v2-general-card {
/*    border: 1px solid #dfe3eb;*/
    background-color: var(--cds-field-01, #f4f4f4);
    padding: 12px;
    margin-bottom: 10px;
}

.v2-general-card-title {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--cds-text-primary, #161616);
}

.v2-general-field {
    margin-bottom: 10px;
}

.v2-general-field .form-label,
.v2-general-field .cds-label {
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--cds-text-secondary, #525252);
}

.v2-general-field .cds-combobox,
.v2-general-field .carbon-textbox {
    height: 32px;
}

.v2-general-switch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.v2-general-switch-item {
    border: 1px solid var(--cds-border-subtle-01, #e0e0e0);
    padding: 8px;
    background-color: var( --cds-layer-03, #fafafa);
}

.v2-general-btn-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.v2-general-btn-row .cds-btn {
    flex: 1 1 0;
    min-width: 0;
}

.v2-general-check-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.v2-general-textarea {
    min-height: 82px;
    resize: vertical;
}

.v2-general-help {
    margin-top: 6px;
    font-size: 12px;
    color: var(--cds-text-secondary, #525252);
}

.v2-general-statusbar {
    padding: 8px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.v2-general-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    border: 1px solid #d0d7e2;
    border-radius: 999px;
    background: #f3f7ff;
    color: #334155;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1;
}

/* V2 general chat tuning (v1 structure + Gemini user bubble) */
.v2-general-page .echo-chat-host {
    background-color: var(--cds-field, #ffffff);
}

.v2-general-page .echo-chat-host > .dock-content.rx-scroll {
    padding: 14px clamp(12px, 2.2vw, 28px) 20px !important;
}

.v2-general-page .echo-chat-host .echo-chat-message-row--assistant,
.v2-general-page .echo-chat-host .chat-assistant-container {
    justify-content: center;
    width: 100%;
}

    .v2-general-page .echo-chat-host .echo-chat-bubble--assistant {
        width: min(100%, 920px);
        max-width: min(100%, 920px);
        box-shadow: none;
        background: transparent;
    }

.v2-general-page .echo-chat-host .echo-chat-bubble--assistant .card-body {
    padding: 0 !important;
}

.v2-general-page .echo-chat-host .echo-chat-message-row--user {
    justify-content: flex-end;
}

    .v2-general-page .echo-chat-host .echo-chat-bubble--user {
        position: relative;
        width: fit-content;
        font-size: 14px;
        max-width: min(72%, 680px);
        border-color: #c7d8ff !important;
        border-radius: 25px 4px 25px 25px !important;
        /*    background: linear-gradient(180deg, #edf3ff 0%, #e7efff 100%);*/
        background-color: var(--cds-echo-bubble, #f4f4f4);
    }


.v2-general-page .echo-chat-host .request-container {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px clamp(12px, 2.2vw, 28px) 12px !important;
    z-index: 2;
    background: linear-gradient(180deg, rgba(247, 248, 251, 0) 0%, rgba(247, 248, 251, 0.94) 26%, rgba(247, 248, 251, 1) 100%);
}

.v2-general-page .echo-chat-host .request-container .request-content {
    width: min(100%, 920px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    border: 1px solid #d9dde6;
    border-radius: 14px;
    background: #ffffff;
    padding: 4px 6px 4px 14px;
    box-sizing: border-box;
    overflow: hidden;
}

.v2-general-page .echo-chat-host .request-container .request-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px !important;
    line-height: 40px;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.v2-general-page .echo-chat-host .request-container .request-content .cds-icon-only-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: #eef3fb;
    color: #334155;
}

.v2-general-page .echo-chat-host .request-container .request-content .cds-icon-only-btn:hover {
    background: #e2eaf8 !important;
}

.v2-general-page .echo-chat-host .request-container .request-content .cds-icon-only-btn:disabled {
    opacity: 0.55;
}

.v2-general-page .echo-chat-host .request-container .request-content .echo-chat-stop-btn {
    min-width: 72px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
}

.v2-general-page .request-container .cds-popover-wrap .rx-popover-container .rx-popover-content {
    top: -172px !important;
    left: 0 !important;
    background-color: var(--cds-field, #ffffff) !important;
}
    .v2-general-page .request-container .cds-popover-wrap .rx-popover-container .rx-popover-content .cds-popover-item {
        font-size: 14px !important;
        gap: 16px !important;
        align-items: center;
    }


/* 반짝이는 효과를 가질 부모 요소 */
.echo-phase-card--mcp.is-active, .echo-phase-card--thinking.is-active {
    position: relative;
    overflow: hidden;
    display: inline-block; /* 텍스트 너비만큼만 잡히도록 설정 (필요시 수정) */
    color: #555; /* 글자색은 적절히 조정하세요 */
}

    /* 반짝이는 레이어 (유저님이 주신 코드 기반) */
    .echo-phase-card--mcp.is-active::after, .echo-phase-card--thinking.is-active::after {
        content: "";
        position: absolute;
        inset: 0;
        transform: translateX(-120%);
        background: linear-gradient( 90deg, transparent 0%, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0) 65%, transparent 100% );
        mix-blend-mode: screen;
        animation: thinkingSweep 1.3s ease-in-out infinite;
        pointer-events: none;
    }

/* 애니메이션 정의 (누락되었던 부분 추가) */
@keyframes thinkingSweep {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(120%);
    }
}

@keyframes echoProgressPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(15, 98, 254, 0.28);
        transform: scale(0.92);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(15, 98, 254, 0);
        transform: scale(1);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(15, 98, 254, 0);
        transform: scale(0.92);
    }
}

@keyframes echoProgressTextSweep {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -20% 0;
    }
}

@keyframes echoProgressDetailFade {
    0% {
        opacity: 0.65;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.65;
    }
}

/* 로딩 스피너 */
/* 기본: 모든 assistant 메시지는 아이콘만 보이게 */
.chat-assistant-container .echo-message-icon .spinner-border {
    display: none;
}

.chat-assistant-container .echo-message-icon .carbon-icon {
    display: inline-block;
}

/* 마지막 assistant 메시지에서만,
            "아이콘에 IsLoading 클래스가 붙어있을 때" 스피너만 보이게 */
.chat-assistant-container:last-of-type
.echo-message-icon:has(.carbon-icon.is-loading) .spinner-border {
    display: inline-block;
}

.chat-assistant-container:last-of-type
.echo-message-icon:has(.carbon-icon.is-loading) .carbon-icon {
    display: none;
}




/* 이미지 업로드 */
.v2-general-page .request-content {
    position: relative;
    z-index: 10;
}

.v2-general-page .image-preview-section {
    background-color: var(--cds-field, #ffffff) !important;
    border-bottom: none !important;
    position: absolute;
    bottom: 45px;
    padding-bottom: 18px !important;
    width: 100%;
    z-index:9;
}

.v2-general-page .image-preview-item {
    border: none !important;
    padding: 0 !important;
}
.v2-general-page .image-info {
    background-color: var(--cds-layer-02, #e0e0e0) !important;
    color: var(--cds-text-primary, #161616) !important;
    left: 0 !important;
    right: 0 !important;
    word-break: break-all;
    padding: 2px 18px 2px 6px;
}

/* V1 AI mode switcher */
.ai-mode-selector-bottom {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 8px 16px;
}

.ai-mode-toggle-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-mode-toggle-group .btn {
    min-width: 60px;
    border-radius: 0;
    border-color: #dee2e6;
    font-size: 11px;
    padding: 6px 12px;
    transition: all 0.2s ease;
}

.ai-mode-toggle-group .btn:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.ai-mode-toggle-group .btn:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.ai-mode-toggle-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.ai-mode-toggle-group .btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff;
    font-weight: 500;
}

.ai-mode-toggle-group .btn-outline-primary {
    background-color: #ffffff;
    border-color: #dee2e6;
    color: #6c757d;
}

.ai-mode-toggle-group .btn-outline-primary:hover {
    background-color: #e3f2fd;
    border-color: #007bff;
    color: #007bff;
}

@media (max-width: 1280px) {
    .v2-general-side {
        width: 380px;
    }

    .v2-general-page .request-container .cds-popover-wrap .rx-popover-container .rx-popover-content {
        top: -163px !important;
        left: 0 !important;
    }
}

@media (max-width: 992px) {
    .v2-general-side {
        width: 340px;
    }

    .v2-general-chip {
        font-size: 0.7rem;
    }

    .v2-general-page .echo-chat-host .echo-chat-bubble--user {
        max-width: 82%;
    }

    .v2-general-page .echo-chat-host .request-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

@media (max-width: 768px) {
    .ai-mode-toggle-group .btn {
        min-width: 50px;
        font-size: 10px;
        padding: 4px 8px;
    }

    .ai-mode-selector-bottom {
        padding: 6px 12px;
    }
}

/* V2-C7 기억 패널 공용 — 인라인 스타일 금지(Carbon 검사) 대응 클래스 */
.echo-memory-scroll { overflow-y: auto; }
.echo-memory-note { font-size: 11px; }
.echo-memory-note--success { font-size: 11px; color: var(--echo-green-50, #24a148); }
.echo-memory-card { border-radius: 8px; }
.echo-memory-content { font-size: 13px; }
.echo-memory-source { font-size: 10px; }
