/* _12e: 上下文全景 (进度条+堆叠层+饼图+流程图+对话详情弹窗) (从 _12_workflow_tchat 拆分) */

/* ============================================================================
   ȫ (wf-ctx-*)  Tokenӻ + ק㼶 + ͼ
   ============================================================================ */

.wf-ctx-panorama {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.75rem;
    gap: 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* --- ϰ벿ͼӦСۣ --- */
.wf-ctx-top-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

/* ---  --- */
.wf-ctx-progress-section {
    margin-bottom: 0;
}

.wf-ctx-progress-bar {
    width: 100%;
    height: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 0.25rem 0;
}

.wf-ctx-progress-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--accent-color, var(--blue-info-dim));
}

.wf-ctx-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-canvas-xxs);
    color: var(--text-secondary, var(--steel-muted));
    margin-top: 0.125rem;
}

.wf-ctx-status {
    font-size: var(--font-canvas-xxs);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.wf-ctx-status.healthy { color: var(--green-led); border: 1px solid rgba(0, 255, 136, 0.2); }
.wf-ctx-status.warning { color: var(--c-ff8c00); border: 1px solid rgba(255, 140, 0, 0.2); }
.wf-ctx-status.critical { color: var(--red-led); border: 1px solid rgba(255, 68, 68, 0.2); }

/* --- ק㼶ѵ --- */
.wf-ctx-stack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.wf-ctx-stack-title {
    font-size: var(--font-canvas-xs);
    color: var(--text-secondary, var(--steel-muted));
    font-weight: 600;
}

.wf-ctx-stack-actions {
    display: flex;
    gap: 0.25rem;
}

.wf-ctx-action-btn {
    background: none;
    border: 1px solid var(--border-primary, var(--bg-raised-navy));
    color: var(--text-secondary, var(--steel-muted));
    font-size: var(--font-canvas-xxs);
    padding: 0.125rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-family: var(--tno-font-mono, monospace);
    transition: border-color 0.2s, color 0.2s;
}

.wf-ctx-action-btn:hover {
    border-color: var(--accent-color, var(--blue-info-dim));
    color: var(--accent-color, var(--blue-info-dim));
}

.wf-ctx-stack {
    display: flex;
    flex-direction: column;
    gap: 0.1875rem;
    margin-bottom: 0.75rem;
}

.wf-ctx-stack-layer {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-primary, var(--bg-raised-navy));
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    cursor: grab;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-size: var(--font-canvas-xs);
}

.wf-ctx-stack-main {
    flex: 1;
    min-width: 0;
}

.wf-ctx-stack-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wf-ctx-stack-desc {
    font-size: calc(var(--font-canvas-xxs) - 0.0625rem);
    margin-top: 0.125rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-ctx-stack-layer:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(74, 144, 217, 0.2);
}

.wf-ctx-stack-layer.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.wf-ctx-stack-layer.drag-over {
    border-color: var(--accent-color, var(--blue-info-dim));
    background: rgba(74, 144, 217, 0.08);
}

.wf-ctx-drag-handle {
    color: var(--text-secondary, var(--steel-muted));
    opacity: 0.3;
    font-size: var(--font-canvas-md);
    cursor: grab;
    flex-shrink: 0;
}

.wf-ctx-stack-role {
    font-size: calc(var(--font-canvas-xxs) - 0.0625rem);
    padding: 0.0625rem 0.3125rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 2.625rem;
    text-align: center;
}

.wf-ctx-stack-role.system { background: rgba(74, 144, 217, 0.12); color: var(--blue-info-dim); }
.wf-ctx-stack-role.user { background: rgba(0, 255, 136, 0.08); color: var(--green-led); }
.wf-ctx-stack-role.assistant { background: rgba(255, 140, 0, 0.08); color: var(--c-ff8c00); }
.wf-ctx-stack-role.context { background: rgba(192, 132, 252, 0.08); color: var(--purple-tailwind); }
.wf-ctx-stack-role.tool { background: rgba(255, 68, 68, 0.08); color: var(--red-led); }

.wf-ctx-stack-info {
    margin-left: auto;
    font-size: var(--font-canvas-xxs);
    color: var(--text-secondary, var(--steel-muted));
    opacity: 0.5;
    flex-shrink: 0;
    font-weight: 600;
}

/* --- ͼ  ӦСʾ --- */
.wf-ctx-pie-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary, var(--bg-raised-navy));
    width: 100%;
    max-width: 32vw;
}

.wf-ctx-pie-section canvas {
    max-width: 100%;
    height: auto !important;
}

.wf-ctx-pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: center;
    margin-top: 0.75rem;
    padding-top: 0.625rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.wf-ctx-pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--font-canvas-xxs);
    color: var(--text-secondary, var(--steel-muted));
}

.wf-ctx-pie-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}


/* ============================================================================
   Agent ͼ (wf-agent-flow)
   ============================================================================ */

.wf-agent-flow {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
}


/* ============================================================================
   Ի鵯 (wf-conv-*)  εͬ
   ============================================================================ */

.wf-conv-detail-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* .wf-conv-detail-close / .wf-conv-detail-close-btn 死代码已于 2026-09-12
   物理删除 (全仓零使用点, ✕收编归 .leucs-x-btn) */

