* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    height: 100vh;
}

/* 顶部标题栏 */
.top-bar {
    height: 50px;
    background: #fcfbf8;
    border-bottom: 1px solid #e8e5dd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.top-bar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #2d2d2d;
}

.top-bar .logo i {
    color: #8b7355;
}

.version-badge {
    font-size: 11px;
    font-weight: 500;
    color: #8b7355;
    background: rgba(139, 115, 85, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 4px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-action-btn {
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #e8e5dd;
    background: #fff;
    color: #5a5a5a;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.top-action-btn:hover {
    border-color: #d4d1c7;
    color: #2d2d2d;
    background: #fdfaf3;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.top-action-btn i {
    font-size: 12px;
    color: #8b7355;
}

.top-action-btn.primary {
    background: #2d2d2d;
    color: #fff;
    border-color: #2d2d2d;
}

.top-action-btn.primary:hover {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.top-action-btn.primary i {
    color: #fff;
}

#testBtn.active {
    background: #4a90e2;
    border-color: #4a90e2;
}

/* 主容器 */
.main-container {
    display: flex;
    height: calc(100vh - 50px);
    overflow: hidden;
}

/* 左侧节点面板 */
.node-panel {
    width: 260px;
    background: #fcfbf8;
    border-right: 1px solid #e8e5dd;
    overflow-y: auto;
    overflow-x: hidden;
}

.panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e8e5dd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #2d2d2d;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    padding: 5px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

.node-categories {
    padding: 10px 0;
}

.category {
    margin-bottom: 20px;
}

.category h4 {
    font-size: 11px;
    font-weight: 600;
    color: #8b7355;
    text-transform: uppercase;
    padding: 10px 16px 5px;
    letter-spacing: 0.5px;
}

.node-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: grab;
    transition: background 0.2s;
    gap: 10px;
}

.node-item:hover {
    background: #f5f3ee;
}

.node-item:active {
    cursor: grabbing;
}

.node-item i {
    font-size: 20px;
    color: #4a90e2;
    width: 24px;
    text-align: center;
}

.node-info {
    flex: 1;
}

.node-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.node-desc {
    font-size: 12px;
    color: #999;
}

/* 画布容器 */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    transition: margin-right 0.3s ease;
}

.canvas-container.chat-open {
    margin-right: 400px;
}

.canvas {
    width: 100%;
    height: 100%;
    background-color: #f8f9fc;
    background-image: radial-gradient(circle, #d5dbe5 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
    overflow: auto;
    user-select: none;
    -webkit-user-select: none;
    background-attachment: local;
}

.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connections path {
    fill: none;
}

.connections path.connection-line:hover {
    stroke: #4a90e2 !important;
    stroke-width: 2.5 !important;
    cursor: pointer;
}

/* 工作流节点 */
.workflow-node {
    position: absolute;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e8e5dd;
    min-width: 220px;
    cursor: move;
    z-index: 10;
    transition: box-shadow 0.2s, transform 0.15s;
    user-select: none;
}

.workflow-node:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.workflow-node.selected {
    box-shadow: 0 0 0 2px #8b7355, 0 4px 12px rgba(139, 115, 85, 0.15);
    border-color: #8b7355;
}

/* 节点图标按类型着色 */
.start-node .node-header i { color: #667eea; }
.reply-node .node-header i { color: #10b981; }
.condition-node .node-header i { color: #f59e0b; }
.code-node .node-header i { color: #8b5cf6; }
.loop-node .node-header i { color: #06b6d4; }
.ai-chat-node .node-header i { color: #f43f5e; }
.system-config-node .node-header i { color: #6b7280; }
.knowledge-node .node-header i { color: #3b82f6; }
.classify-node .node-header i { color: #ec4899; }
.text-to-sql-rule-node .node-header i { color: #14b8a6; }
.text-to-sql-node .node-header i { color: #0ea5e9; }
.csv-report-node .node-header i { color: #f97316; }
.datasource-report-node .node-header i { color: #8b5cf6; }

/* 节点标题背景淡色标识 */
.start-node .node-header { background: rgba(102, 126, 234, 0.07); }
.reply-node .node-header { background: rgba(16, 185, 129, 0.07); }
.condition-node .node-header { background: rgba(245, 158, 11, 0.07); }
.code-node .node-header { background: rgba(139, 92, 246, 0.07); }
.loop-node .node-header { background: rgba(6, 182, 212, 0.07); }
.ai-chat-node .node-header { background: rgba(244, 63, 94, 0.07); }
.system-config-node .node-header { background: rgba(107, 114, 128, 0.07); }
.knowledge-node .node-header { background: rgba(59, 130, 246, 0.07); }
.classify-node .node-header { background: rgba(236, 72, 153, 0.07); }
.text-to-sql-rule-node .node-header { background: rgba(20, 184, 166, 0.07); }
.text-to-sql-node .node-header { background: rgba(14, 165, 233, 0.07); }
.csv-report-node .node-header { background: rgba(249, 115, 22, 0.07); }
.datasource-report-node .node-header { background: rgba(139, 92, 246, 0.07); }

.node-header {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 11px 11px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.node-header i {
    font-size: 16px;
    color: #5a5a5a;
}

.node-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.node-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 12px;
    padding: 4px;
    transition: color 0.2s;
    border-radius: 4px;
}

.node-delete:hover {
    color: #f44336;
    background: rgba(244, 67, 54, 0.06);
}

.node-body {
    padding: 12px 14px;
}

.node-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.node-config {
    display: none;
}

.node-config.active {
    display: block;
}

.config-item {
    margin-bottom: 16px;
}

.config-item label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
}

.config-item input,
.config-item textarea,
.config-item select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.config-item input:focus,
.config-item textarea:focus,
.config-item select:focus {
    outline: none;
    border-color: #4a90e2;
}

.config-item textarea {
    resize: vertical;
    min-height: 80px;
}

.config-item .toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.toggle-switch .info-icon {
    color: #999;
    cursor: help;
}

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn {
    padding: 7px 14px;
    border: 1px solid #e8e5dd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #5a5a5a;
    transition: all 0.2s;
}

.btn:hover {
    background: #fdfaf3;
    border-color: #d4d1c7;
    color: #2d2d2d;
}

.btn-primary {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.btn-primary:hover {
    background: #357abd;
}

/* 连接点 */
.connection-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #b0bec5;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: crosshair;
    z-index: 20;
    transition: all 0.18s ease;
    opacity: 0.5;
}

.workflow-node:hover .connection-point {
    opacity: 1;
}

.connection-point.output {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point.input {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point.output:hover {
    background: #4a90e2;
    transform: translateY(-50%) scale(1.4);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
}

/* 连线拖拽模式 */
body.connecting-mode .connection-point.input {
    opacity: 1;
    background: #4a90e2;
    animation: connPulse 1.2s ease-in-out infinite;
}

body.connecting-mode .connection-point.input.no-connect {
    opacity: 0.2;
    animation: none;
    background: #b0bec5;
    cursor: not-allowed;
}

body.connecting-mode .connection-point.input.snap-target {
    transform: translateY(-50%) scale(2.2);
    background: #2563eb;
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.18);
    animation: none;
}

@keyframes connPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4); }
    50% { box-shadow: 0 0 0 5px rgba(74, 144, 226, 0); }
}

/* 连线删除按钮 */
.conn-delete-btn {
    position: fixed;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 200;
    transform: translate(-50%, -50%) scale(0);
    animation: connDelPop 0.18s ease forwards;
}

.conn-delete-btn:hover {
    background: #dc2626;
    transform: translate(-50%, -50%) scale(1.15);
}

@keyframes connDelPop {
    from { transform: translate(-50%, -50%) scale(0); }
    to { transform: translate(-50%, -50%) scale(1); }
}

/* 条件节点动画 */
.workflow-node.condition-node.executing {
    animation: conditionPulse 1s infinite;
}

@keyframes conditionPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 0 0 0 rgba(74, 144, 226, 0.7);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 0 0 10px rgba(74, 144, 226, 0);
    }
}

.workflow-node.executing {
    box-shadow: 0 0 0 2px #4a90e2, 0 4px 12px rgba(74, 144, 226, 0.2);
}

/* 旧浮动按钮已移至顶栏 */

.return-btn {
    width: 100%;
    padding: 9px 16px;
    background: #2d2d2d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.return-btn:hover {
    background: #1a1a1a;
}

/* 右侧聊天栏 */
.chat-sidebar {
    position: fixed;
    right: -400px;
    top: 50px;
    width: 400px;
    height: calc(100vh - 50px);
    background: #fcfbf8;
    border-left: 1px solid #e8e5dd;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 16px rgba(0,0,0,0.06);
}

.chat-sidebar.active {
    right: 0;
}

.chat-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e8e5dd;
    background: #fcfbf8;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.chat-sidebar-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #2d2d2d;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clear-chat-btn {
    position: absolute;
    right: 44px;
    top: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 13px;
    padding: 6px 8px;
    transition: all 0.2s;
    border-radius: 6px;
}

.clear-chat-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.06);
}

/* 自定义模型选择器 */
.model-select-custom {
    position: relative;
    width: 100%;
}

.model-select-trigger {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid #e8e5dd;
    background: #fff;
    font-size: 13px;
    color: #2d2d2d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.05);
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.model-select-trigger:hover {
    border-color: #d4d1c7;
    background: #fdfaf3;
    box-shadow: 0 2px 6px rgba(15,23,42,0.06);
}

.model-select-custom.open .model-select-trigger {
    border-color: #8b7355;
    box-shadow: 0 4px 12px rgba(15,23,42,0.1);
}

.model-select-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-select-trigger .fa-angle-down {
    color: #8b7355;
    font-size: 12px;
    transition: transform 0.2s;
}

.model-select-custom.open .fa-angle-down {
    transform: rotate(180deg);
}

.model-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 36px rgba(15,23,42,0.14);
    padding: 6px 0;
    display: none;
    flex-direction: column;
    z-index: 200;
    max-height: 300px;
}

.model-select-custom.open .model-select-dropdown {
    display: flex;
}

.model-select-custom.dropdown-up .model-select-dropdown {
    top: auto;
    bottom: calc(100% + 6px);
}

.model-select-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid #f0ede6;
}

.model-select-search i {
    color: #9ca3af;
    font-size: 12px;
}

.model-select-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #2d2d2d;
}

.model-select-search input::placeholder {
    color: #9ca3af;
}

.model-select-list {
    overflow-y: auto;
    padding: 4px;
}

.model-select-item {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #2d2d2d;
    text-align: left;
    transition: background 0.12s;
    display: block;
}

.model-select-item:hover {
    background: #f5f3ee;
}

.model-select-item.active {
    background: rgba(139, 115, 85, 0.08);
    font-weight: 500;
}

.collapse-chat-btn {
    position: absolute;
    right: 10px;
    top: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
    padding: 6px;
    transition: all 0.2s;
    border-radius: 6px;
}

.collapse-chat-btn:hover {
    color: #2d2d2d;
    background: rgba(0,0,0,0.04);
}

.chat-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f5f3ee;
}

.message {
    display: flex;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
}

.message.bot {
    align-self: flex-start;
}

.message-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.message.user .message-content {
    background: #2d2d2d;
    color: white;
}

.message.bot .message-content {
    background: #fff;
    color: #2d2d2d;
    border: 1px solid #e8e5dd;
}

.chat-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #e8e5dd;
    background: #fcfbf8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #d4d1c7;
    border-radius: 12px;
    font-size: 14px;
    color: #2d2d2d;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #8b7355;
}

.chat-input::placeholder {
    color: #9ca3af;
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2d2d2d;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #1a1a1a;
    transform: scale(1.05);
}

/* 配置模态框 */
.config-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.config-modal.active {
    display: flex;
}

.config-modal-content {
    width: 580px;
    max-height: 80vh;
    background: #fcfbf8;
    border-radius: 16px;
    border: 1px solid #e8e5dd;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 45px rgba(0,0,0,0.15);
}

.config-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e8e5dd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d2d2d;
}

.config-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 选中数据源样式 */
.selected-datasource {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-top: 8px;
}

.selected-datasource i {
    color: #4a90e2;
}

.selected-datasource span {
    flex: 1;
    font-size: 14px;
}

.selected-datasource .remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

.selected-datasource .remove-btn:hover {
    color: #f44336;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d4d1c7;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b7355;
}

/* SVG箭头标记 */
#arrowhead {
    fill: #b0bec5;
}

/* 旧AI创建按钮已移至顶栏 */

/* 自然语言创建 Agent 对话框 */
.ai-create-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.ai-create-modal.active {
    display: flex;
}

.ai-create-modal-content {
    background: #fcfbf8;
    border-radius: 16px;
    width: 90%;
    max-width: 780px;
    height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    border: 1px solid #e8e5dd;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ai-create-header {
    background: #fcfbf8;
    color: #2d2d2d;
    padding: 16px 24px;
    border-radius: 15px 15px 0 0;
    border-bottom: 1px solid #e8e5dd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-create-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.ai-create-title i {
    font-size: 18px;
    color: #8b7355;
}

.ai-create-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.ai-create-close:hover {
    background: rgba(0,0,0,0.04);
    color: #2d2d2d;
}

.ai-create-body {
    flex: 1;
    overflow-y: auto;
    background: #f5f3ee;
}

/* 欢迎界面 */
.ai-create-welcome {
    padding: 60px 40px;
    text-align: center;
}

.welcome-icon {
    font-size: 56px;
    color: #8b7355;
    margin-bottom: 16px;
    opacity: 0.7;
}

.ai-create-welcome h3 {
    font-size: 22px;
    color: #2d2d2d;
    margin-bottom: 8px;
    font-weight: 600;
}

.ai-create-welcome p {
    font-size: 14px;
    color: #5a5a5a;
    margin-bottom: 32px;
}

.example-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    max-width: 720px;
    margin: 0 auto;
}

.example-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e8e5dd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.example-card:hover {
    border-color: #d4d1c7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.example-card i {
    font-size: 28px;
    color: #8b7355;
    margin-bottom: 8px;
}

.example-card h4 {
    font-size: 14px;
    color: #2d2d2d;
    margin: 8px 0 6px 0;
    font-weight: 600;
}

.example-card p {
    font-size: 12px;
    color: #5a5a5a;
    margin: 0;
}

/* 对话界面 */
.ai-create-chat {
    padding: 20px;
    min-height: 100%;
}

.ai-create-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ai-message.bot .ai-message-avatar {
    background: #8b7355;
    color: white;
}

.ai-message.user .ai-message-avatar {
    background: #2d2d2d;
    color: white;
}

.ai-message-content {
    background: white;
    padding: 14px 18px;
    border-radius: 16px;
    max-width: 75%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    line-height: 1.6;
}

.ai-message.user .ai-message-content {
    background: #2d2d2d;
    color: white;
}

.workflow-preview {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.workflow-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
}

.workflow-preview-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.workflow-preview-node {
    background: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    border: 1px solid #ddd;
}

.workflow-preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.workflow-action-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.workflow-action-btn.primary {
    background: #2d2d2d;
    color: white;
}

.workflow-action-btn.primary:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.workflow-action-btn.secondary {
    background: #e8e5dd;
    color: #5a5a5a;
}

.workflow-action-btn.secondary:hover {
    background: #d4d1c7;
}

/* 底部输入区域 */
.ai-create-footer {
    padding: 16px 24px;
    background: #fcfbf8;
    border-radius: 0 0 15px 15px;
    border-top: 1px solid #e8e5dd;
}

.ai-create-model-select {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #5a5a5a;
}

.ai-create-model-select label {
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-create-model-select i {
    color: #8b7355;
}

.ai-create-model-select .model-select-custom {
    max-width: 220px;
}

.ai-create-model-select select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e8e5dd;
    border-radius: 8px;
    font-size: 13px;
    color: #2d2d2d;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: border-color 0.2s;
}

.ai-create-model-select select:focus {
    outline: none;
    border-color: #8b7355;
}

.ai-create-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-create-input {
    flex: 1;
    padding: 12px 14px;
    border: 1.5px solid #d4d1c7;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 46px;
    max-height: 120px;
    color: #2d2d2d;
    background: #fff;
    transition: border-color 0.2s;
}

.ai-create-input:focus {
    outline: none;
    border-color: #8b7355;
}

.ai-create-input::placeholder {
    color: #9ca3af;
}

.ai-create-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #2d2d2d;
    color: white;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-create-send:hover {
    background: #1a1a1a;
    transform: scale(1.05);
}

.ai-create-send:disabled {
    background: #d4d1c7;
    cursor: not-allowed;
    transform: none;
}

/* 画布小地图预览 */
.minimap {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 220px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0;
    z-index: 50;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.minimap-header {
    padding: 6px 12px;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.minimap-header span {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.minimap-header span i {
    color: #4a90e2;
    font-size: 11px;
}

.minimap-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 11px;
    padding: 2px 4px;
    transition: all 0.2s;
    border-radius: 3px;
}

.minimap-toggle:hover {
    color: #333;
    background: #eee;
}

.minimap-body {
    height: 150px;
    background: #f8f9fb;
    cursor: pointer;
    transition: height 0.2s ease;
    overflow: hidden;
}

.minimap.collapsed .minimap-body {
    height: 0;
}

.minimap.collapsed .minimap-toggle i {
    transform: rotate(180deg);
}

.minimap-body canvas {
    width: 100%;
    height: 100%;
    display: block;
}

