/* ========================================
   AI协同办公平台 - 样式表
   ======================================== */

/* ----- CSS 变量 ----- */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242836;
    --bg-card: #1e2130;
    --bg-input: #161822;
    --border-color: #2a2d3a;
    --border-light: #353849;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0b0;
    --text-muted: #5f6578;
    --accent-blue: #4f8cf7;
    --accent-blue-hover: #3a70d6;
    --accent-green: #34d399;
    --accent-green-hover: #2bb07a;
    --accent-orange: #f59e0b;
    --accent-orange-hover: #d98c09;
    --accent-red: #ef4444;
    --accent-purple: #a78bfa;
    --accent-cyan: #22d3ee;
    --gradient-1: linear-gradient(135deg, #4f8cf7, #a78bfa);
    --gradient-2: linear-gradient(135deg, #34d399, #22d3ee);
    --gradient-3: linear-gradient(135deg, #f59e0b, #ef4444);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.25s ease;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

/* ----- 基础重置 ----- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ----- 顶部导航栏 ----- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    font-size: 1.4rem;
    -webkit-text-fill-color: var(--accent-blue);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(52,211,153,0.5);
}

.status-dot.offline {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(239,68,68,0.4);
}

/* ----- 按钮样式 ----- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-blue-hover);
    box-shadow: 0 0 20px rgba(79,140,247,0.3);
}

.btn-success {
    background: var(--accent-green);
    color: #111;
}
.btn-success:hover:not(:disabled) {
    background: var(--accent-green-hover);
    box-shadow: 0 0 20px rgba(52,211,153,0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}
.icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ----- 应用容器 ----- */
.app-container {
    display: flex;
    height: calc(100vh - 56px);
}

/* ----- 侧边栏 ----- */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 20px 12px;
}
.sidebar-header h2 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.team-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

.team-card.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    box-shadow: 0 0 16px rgba(79,140,247,0.15);
}

.team-card.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}

.team-card-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.team-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.team-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.team-card-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.team-card-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* ----- 主内容区 ----- */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

/* ----- 工作流头部 ----- */
.workflow-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.workflow-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.workflow-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 模式切换 */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.mode-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-switch {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 20px;
    padding: 3px;
}

.toggle-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toggle-btn.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 120px;
}

/* ----- 流水线 ----- */
.pipeline-section {
    margin-bottom: 24px;
}

.pipeline-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.pipeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.pipeline-node-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 2px solid var(--border-light);
    background: var(--bg-tertiary);
    transition: var(--transition);
    margin-bottom: 8px;
}

.pipeline-node.active .pipeline-node-icon {
    border-color: var(--accent-blue);
    background: rgba(79,140,247,0.15);
    box-shadow: 0 0 20px rgba(79,140,247,0.3);
    animation: pulse 2s infinite;
}

.pipeline-node.completed .pipeline-node-icon {
    border-color: var(--accent-green);
    background: rgba(52,211,153,0.15);
}

.pipeline-node.completed .pipeline-node-icon::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent-green);
    color: #111;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pipeline-node.error .pipeline-node-icon {
    border-color: var(--accent-red);
    background: rgba(239,68,68,0.15);
}

.pipeline-node-label {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.pipeline-node-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.pipeline-node-api {
    font-size: 0.65rem;
    color: var(--accent-cyan);
    margin-top: 2px;
    background: rgba(34,211,238,0.1);
    padding: 1px 6px;
    border-radius: 8px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pipeline-connector {
    width: 60px;
    height: 2px;
    background: var(--border-light);
    margin: 0 4px;
    position: relative;
    margin-bottom: 28px;
}

.pipeline-connector.completed {
    background: var(--accent-green);
}

.pipeline-connector::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: -6px;
    top: -8px;
    font-size: 0.55rem;
    color: var(--border-light);
}

.pipeline-connector.completed::after {
    color: var(--accent-green);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79,140,247,0.4); }
    50% { box-shadow: 0 0 0 12px rgba(79,140,247,0); }
}

/* ----- 输入区域 ----- */
.input-section {
    margin-bottom: 24px;
}

.input-header {
    margin-bottom: 10px;
}

.input-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-body {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

#userInput {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 14px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.6;
}

#userInput:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79,140,247,0.1);
}

#userInput::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* ----- 工作台区域 ----- */
.workbench-section {
    margin-bottom: 24px;
}

.stage-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.stage-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    white-space: nowrap;
}

.stage-badge.running {
    background: rgba(79,140,247,0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    animation: pulse-text 1.5s infinite;
}

.stage-badge.done {
    background: rgba(52,211,153,0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.stage-badge.error {
    background: rgba(239,68,68,0.15);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* 阶段输出 */
.stage-output {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.3s;
}
.stage-output.streaming {
    border-color: var(--accent-blue);
    box-shadow: 0 0 16px rgba(79,140,247,0.2);
}

.stage-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.stage-ai-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stage-ai-info i {
    font-size: 1.2rem;
    color: var(--accent-purple);
}

.stage-ai-info span {
    font-weight: 600;
    font-size: 0.95rem;
}

.stage-status {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-weight: 500;
}

.stage-status.working {
    background: rgba(79,140,247,0.2);
    color: var(--accent-blue);
}

.stage-status.done {
    background: rgba(52,211,153,0.2);
    color: var(--accent-green);
}

.stage-output-content {
    padding: 20px;
    min-height: 200px;
    max-height: 70vh;
    overflow-y: auto;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
}

.stage-output-content .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.stage-output-content .empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* Markdown style inside output */
.stage-output-content h1, .stage-output-content h2, .stage-output-content h3 {
    margin: 16px 0 8px;
    color: var(--text-primary);
}
.stage-output-content code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.stage-output-content pre {
    background: var(--bg-input);
    padding: 14px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    border: 1px solid var(--border-light);
    margin: 10px 0;
}
.stage-output-content pre code {
    background: none;
    padding: 0;
}
.stage-output-content ul, .stage-output-content ol {
    margin: 8px 0;
    padding-left: 24px;
}
.stage-output-content blockquote {
    border-left: 3px solid var(--accent-blue);
    padding-left: 14px;
    color: var(--text-secondary);
    margin: 8px 0;
}

/* 编辑区域 */
.stage-edit-area {
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    background: rgba(245,158,11,0.05);
}

.edit-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-orange);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

#stageEditText {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 14px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    line-height: 1.6;
}

#stageEditText:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}

/* 底部操作 */
.stage-bottom-actions {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: var(--bg-tertiary);
}

/* ----- 历史记录 ----- */
.history-section {
    margin-bottom: 24px;
}

.history-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--border-light);
    background: var(--bg-tertiary);
}

.history-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.history-item-icon.done { background: rgba(52,211,153,0.2); color: var(--accent-green); }
.history-item-icon.error { background: rgba(239,68,68,0.2); color: var(--accent-red); }
.history-item-icon.running { background: rgba(79,140,247,0.2); color: var(--accent-blue); }

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-role {
    font-weight: 600;
    font-size: 0.85rem;
}

.history-item-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- 弹窗 ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-lg {
    max-width: 640px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79,140,247,0.1);
}

.form-group input[type="range"] {
    width: calc(100% - 40px);
    vertical-align: middle;
}

.range-value {
    display: inline-block;
    width: 32px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-blue);
    font-weight: 600;
}

.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-right: 40px;
}

.input-with-icon .icon-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* AI智能创建区域 */
.ai-create-section {
    background: linear-gradient(135deg, rgba(79,140,247,0.08), rgba(167,139,250,0.08));
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 8px;
}
.ai-create-label {
    font-size: 0.95rem; font-weight: 600; margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.ai-create-label i { color: var(--accent-purple); }
#teamRequirement {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); color: var(--text-primary); padding: 14px;
    font-family: inherit; font-size: 0.9rem; resize: vertical; line-height: 1.6;
}
#teamRequirement:focus { outline: none; border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(167,139,250,0.15); }
#teamRequirement::placeholder { color: var(--text-muted); }
.ai-create-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.ai-create-hint { font-size: 0.75rem; color: var(--text-muted); }
.member-list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.member-count { font-size: 0.75rem; color: var(--accent-cyan); font-weight: 600; }

/* 自定义团队成员 */
.custom-member {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
}

.member-header {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-recommend-btn {
    font-size: 0.72rem !important;
    padding: 3px 10px !important;
    margin-left: auto;
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.input-row input { flex: 1; }
.input-row .btn { flex-shrink: 0; }

.custom-member .member-role {
    margin-bottom: 8px;
}

.custom-member .member-prompt {
    resize: vertical;
    font-size: 0.85rem;
}

.member-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.member-row select,
.member-row input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.82rem;
}

.member-row select:focus,
.member-row input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* ----- 加载遮罩 ----- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,17,23,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(6px);
}

.loading-spinner {
    text-align: center;
}

.loading-spinner i {
    font-size: 3rem;
    color: var(--accent-blue);
    margin-bottom: 16px;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ----- Toast ----- */
.toast-container {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s forwards;
    max-width: 380px;
}

.toast-success { background: var(--accent-green); color: #111; }
.toast-error { background: var(--accent-red); }
.toast-info { background: var(--accent-blue); }
.toast-warning { background: var(--accent-orange); color: #111; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ----- 设置 - 预设/自定义API卡片 ----- */
.settings-section { margin-bottom: 8px; }
.settings-section-title {
    font-size: 0.9rem; font-weight: 600; margin-bottom: 12px;
    display: flex; align-items: center; gap: 6px; color: var(--text-secondary);
}

.api-card {
    background: var(--bg-tertiary); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); margin-bottom: 10px; overflow: hidden;
    transition: var(--transition);
}
.api-card.enabled { border-left: 3px solid var(--accent-green); }
.api-card.disabled { border-left: 3px solid var(--text-muted); opacity: 0.7; }

.api-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
}
.api-card-info { display: flex; align-items: center; gap: 10px; }
.api-card-icon { font-size: 1.3rem; }
.api-card-name { font-weight: 600; font-size: 0.9rem; }
.api-card-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Toggle Switch */
.toggle-switch-api { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; flex-shrink: 0; }
.toggle-switch-api input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background: var(--border-light); border-radius: 24px; transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: var(--transition);
}
.toggle-switch-api input:checked + .toggle-slider { background: var(--accent-green); }
.toggle-switch-api input:checked + .toggle-slider::before { transform: translateX(18px); }

.api-card-body {
    padding: 12px 14px; border-top: 1px solid var(--border-color);
    background: var(--bg-card); display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
}
.api-card-body .form-group { margin-bottom: 0; }
.api-card-body .btn { margin-top: 4px; }

.api-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; border-top: 1px solid var(--border-color);
    font-size: 0.75rem; color: var(--text-muted); gap: 8px; flex-wrap: wrap;
}
.api-card-model { font-family: var(--font-mono); color: var(--accent-cyan); }

.cap-tags { display: flex; gap: 3px; flex-wrap: wrap; }
.cap-tag {
    font-size: 0.65rem; padding: 1px 6px; border-radius: 8px;
    background: var(--bg-primary); color: var(--text-secondary);
}

.btn-link {
    background: none; border: none; color: var(--accent-blue); cursor: pointer;
    font-size: 0.78rem; font-family: inherit; padding: 2px 6px;
}
.btn-link:hover { text-decoration: underline; }

.form-row { display: flex; gap: 12px; }
.empty-hint { text-align: center; color: var(--text-muted); font-size: 0.82rem; padding: 16px; }

.cap-checks { display: flex; gap: 14px; flex-wrap: wrap; }
.cap-checks label { font-size: 0.82rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; cursor: pointer; }
.cap-checks input[type=checkbox] { accent-color: var(--accent-blue); }

.custom-api-form {
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); padding: 16px;
}

/* ----- 媒体附件 ----- */
.media-attachments {
    margin-top: 12px;
}

.media-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.media-preview-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
}

.media-preview-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.media-preview-icon {
    font-size: 1.5rem;
    color: var(--accent-purple);
}

.media-preview-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.media-preview-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 50%;
    font-size: 0.75rem;
    transition: var(--transition);
}
.media-preview-remove:hover {
    color: var(--accent-red);
    background: rgba(239,68,68,0.15);
}

.media-upload-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.upload-label {
    cursor: pointer;
}

.capability-hint {
    margin-top: 8px;
    font-size: 0.75rem;
}

.hint-text {
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(79,140,247,0.1);
    color: var(--accent-blue);
}

/* ----- 团队分类 ----- */
.team-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 16px 4px;
    margin-top: 4px;
}

/* ----- 爱酱聊天面板 ----- */
.chat-panel {
    display: none;
    width: 380px; min-width: 380px;
    background: var(--bg-secondary); border-left: 1px solid var(--border-color);
    flex-direction: column; z-index: 50;
}
.chat-panel.open { display: flex; }

.chat-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}
.chat-panel-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.chat-avatar { font-size: 1.5rem; }
.chat-status { font-size: 0.7rem; color: var(--accent-green); background: rgba(52,211,153,0.15); padding: 2px 8px; border-radius: 10px; }
.chat-panel-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; border-radius: 4px; }
.chat-panel-close:hover { color: var(--text-primary); }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.chat-msg { display: flex; gap: 8px; max-width: 100%; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg-avatar {
    width: 32px; height: 32px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
    background: var(--bg-tertiary);
}
.chat-msg-bubble {
    padding: 10px 14px; border-radius: 16px; font-size: 0.85rem;
    line-height: 1.5; word-break: break-word; max-width: 260px;
}
.chat-msg.ai .chat-msg-bubble {
    background: var(--bg-tertiary); border: 1px solid var(--border-light);
    border-top-left-radius: 4px;
}
.chat-msg.user .chat-msg-bubble {
    background: var(--accent-blue); color: #fff;
    border-top-right-radius: 4px;
}
.chat-msg.ai .chat-msg-bubble .typing { animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.chat-input-area {
    display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary); align-items: flex-end;
}
#chatInput {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border-light);
    border-radius: 20px; color: var(--text-primary); padding: 10px 16px;
    font-family: inherit; font-size: 0.85rem; resize: none; outline: none;
    max-height: 100px;
}
#chatInput:focus { border-color: var(--accent-purple); }
#chatInput::placeholder { color: var(--text-muted); }

.chat-toggle-btn { position: relative; }
.chat-toggle-btn.active { background: var(--accent-purple); color: #fff; border-color: var(--accent-purple); }

@media (max-width: 900px) {
    .chat-panel.open { width: 100%; min-width: 100%; }
}

/* ----- 响应式 ----- */
@media (max-width: 900px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
        flex-shrink: 0;
    }

    .app-container {
        flex-direction: column;
    }

    .main-content {
        padding: 16px;
    }

    .workflow-header {
        flex-direction: column;
    }

    .pipeline-container {
        gap: 8px;
    }

    .pipeline-connector {
        width: 30px;
    }
}
