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

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #0066ff;
    --accent-hover: #0052cc;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.container {
    max-width: 100%;
    margin: 0;
    background: var(--bg-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

header {
    background: var(--primary-color);
    color: white;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo svg {
    color: var(--accent-color);
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.header-actions button svg {
    stroke: currentColor;
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.monitor-btn {
    color: #8cc4ff;
    border-color: rgba(0, 102, 255, 0.35);
    background: rgba(0, 102, 255, 0.15);
}

.monitor-btn:hover {
    background: rgba(0, 102, 255, 0.25);
    border-color: rgba(0, 102, 255, 0.45);
    color: #cfe4ff;
}

.attack-chain-btn {
    color: #ffe08a;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.attack-chain-btn:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff5cc;
}

.attack-chain-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
}

.settings-btn {
    padding: 8px;
    min-width: 44px;
}

/* 侧边栏样式 */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.new-chat-btn span {
    font-size: 1.2em;
    line-height: 1;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    min-height: 0;
}

.sidebar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 8px;
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conversation-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.conversation-group:last-child {
    margin-bottom: 0;
}

.conversation-group-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 8px 8px 0;
}

.conversation-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
}

.conversation-item:hover {
    background: var(--bg-tertiary);
}

.conversation-item:hover .conversation-delete-btn {
    opacity: 1;
}

.conversation-item.active {
    background: var(--bg-primary);
    border-color: var(--accent-color);
}

.conversation-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.conversation-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.conversation-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.conversation-delete-btn svg {
    width: 14px;
    height: 14px;
    transition: all 0.2s ease;
}

.conversation-delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
    opacity: 1;
}

.conversation-delete-btn:hover svg {
    transform: scale(1.1);
}

.conversation-delete-btn:active {
    background: rgba(220, 53, 69, 0.2);
    transform: scale(0.95);
}

.conversation-item.active .conversation-delete-btn {
    opacity: 0.6;
}

.conversation-item.active:hover .conversation-delete-btn {
    opacity: 1;
}

/* 对话界面样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    background: var(--bg-secondary);
    overflow: hidden;
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.message {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
    width: 100%;
}

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

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.message.system {
    justify-content: center;
    margin-bottom: 16px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.message.user .message-avatar {
    background: var(--accent-color);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.message.system .message-avatar {
    display: none;
}

.message-content {
    flex: 0 1 auto;
    max-width: 70%;
    min-width: 120px;
    display: flex;
    flex-direction: column;
}

.message.user .message-content {
    align-items: flex-end;
    margin-left: auto;
}

.message.assistant .message-content {
    align-items: flex-start;
    margin-right: auto;
}

.message.system .message-content {
    max-width: 90%;
    align-items: center;
    margin: 0 auto;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 8px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

/* Markdown 样式 */
.message-bubble p {
    margin: 0.5em 0;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong,
.message-bubble b {
    font-weight: 600;
    color: inherit;
}

.message-bubble em,
.message-bubble i {
    font-style: italic;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
    line-height: 1.5;
}

.message.user .message-bubble pre {
    background: rgba(255, 255, 255, 0.15);
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-bubble li {
    margin: 0.25em 0;
}

.message-bubble blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1em;
    margin: 0.5em 0;
    color: var(--text-secondary);
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    margin: 0.8em 0 0.4em 0;
    font-weight: 600;
    line-height: 1.3;
}

.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child,
.message-bubble h5:first-child,
.message-bubble h6:first-child {
    margin-top: 0;
}

.message-bubble h1 {
    font-size: 1.5em;
}

.message-bubble h2 {
    font-size: 1.3em;
}

.message-bubble h3 {
    font-size: 1.1em;
}

.message-bubble hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1em 0;
}

.message-bubble a {
    color: var(--accent-color);
    text-decoration: none;
}

.message-bubble a:hover {
    text-decoration: underline;
}

.message.user .message-bubble a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.message.user .message-bubble {
    background: var(--accent-color);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.assistant .message-bubble {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
}

.message.assistant .message-bubble pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

.message.system .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.875rem;
    padding: 10px 16px;
    width: 100%;
}

.message-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 2px;
    font-weight: 400;
}

/* MCP调用区域 */
.mcp-call-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.mcp-call-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.mcp-call-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.mcp-call-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.process-detail-btn {
    background: rgba(156, 39, 176, 0.1) !important;
    border-color: rgba(156, 39, 176, 0.3) !important;
    color: #9c27b0 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.process-detail-btn:hover {
    background: rgba(156, 39, 176, 0.2) !important;
    border-color: #9c27b0 !important;
    color: #7b1fa2 !important;
}

.process-detail-btn span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.process-details-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.process-details-content {
    width: 100%;
}

.process-details-content .progress-timeline {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    opacity: 0;
}

.process-details-content .progress-timeline.expanded {
    max-height: 2000px;
    overflow-y: auto;
    opacity: 1;
    margin-top: 12px;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.chat-input-field {
    flex: 1;
    position: relative;
    display: flex;
}

.chat-input-field textarea {
    width: 100%;
}

.chat-input-container textarea {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: none;
    height: 44px;
    font-family: inherit;
    line-height: 1.5;
    overflow-y: auto;
    box-sizing: border-box;
    /* 隐藏滚动条但保留滚动功能 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: transparent transparent; /* Firefox - 隐藏滚动条 */
}

/* WebKit 浏览器（Chrome, Safari, Edge）的滚动条样式 - 隐藏但保留功能 */
.chat-input-container textarea::-webkit-scrollbar {
    width: 4px; /* 最窄的滚动条 */
}

.chat-input-container textarea::-webkit-scrollbar-track {
    background: transparent; /* 隐藏轨道 */
}

.chat-input-container textarea::-webkit-scrollbar-thumb {
    background: transparent; /* 默认隐藏滑块 */
    border-radius: 2px;
}

/* 鼠标悬停时显示滚动条 */
.chat-input-container textarea:hover::-webkit-scrollbar-thumb {
    background: var(--text-muted); /* 悬停时显示 */
}

.chat-input-container textarea:focus::-webkit-scrollbar-thumb {
    background: var(--text-muted); /* 聚焦时显示 */
}

.chat-input-container textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.chat-input-container textarea::placeholder {
    color: var(--text-muted);
}

.chat-input-container button {
    padding: 12px 24px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-input-container button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.chat-input-container button:active {
    transform: translateY(0);
}

.mention-suggestions {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
    padding: 0;
    overflow: hidden;
    display: none;
    z-index: 15;
    backdrop-filter: blur(6px);
    animation: mentionFadeIn 0.15s ease-out;
    box-sizing: border-box;
}

.mention-suggestions-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
    box-sizing: border-box;
}

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

.mention-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 18px;
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.05);
    background: #f7f8fa !important;
    cursor: pointer;
    text-align: left;
    font-size: 0.875rem;
    color: rgba(15, 23, 42, 0.9) !important;
    transition: background 0.18s ease, border-left-color 0.18s ease, color 0.15s ease, transform 0.18s ease;
    border-left: 3px solid transparent;
    outline: none;
    border-radius: 12px;
    margin: 0 0 8px 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    -webkit-appearance: none;
    appearance: none;
}

.mention-item:focus,
.mention-item:focus-visible {
    outline: none;
    box-shadow: none;
}

.mention-item:hover {
    background: #ffffff !important;
    border-left-color: rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.mention-item.active,
.mention-item:focus,
.mention-item:focus-visible {
    background: linear-gradient(105deg, rgba(0, 102, 255, 0.08), rgba(0, 102, 255, 0.02)) !important;
    border-left-color: rgba(0, 102, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 102, 255, 0.22);
    color: rgba(15, 23, 42, 0.95);
}

.mention-item.active .mention-item-name,
.mention-item.active .mention-item-desc,
.mention-item.active .mention-item-meta,
.mention-item.active .mention-status {
    color: rgba(15, 23, 42, 0.95);
}

.mention-item.active .mention-status {
    background: rgba(0, 102, 255, 0.12);
    color: #0052cc;
}

.mention-item.disabled {
    opacity: 0.65;
    box-shadow: none;
}

.mention-item-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(15, 23, 42, 0.95);
}

.mention-item-icon {
    font-size: 1rem;
}

.mention-item-text {
    flex: 1;
}

.mention-item-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.mention-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
}

.mention-status {
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.mention-status.enabled {
    background: rgba(46, 204, 113, 0.18);
    color: #1e8a4d;
}

.mention-status.disabled {
    background: rgba(231, 76, 60, 0.18);
    color: #b23d2f;
}

.mention-origin {
    color: var(--text-secondary);
}

.mention-item-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    font-weight: 600;
}

.mention-item-badge.internal {
    background: rgba(108, 117, 125, 0.18);
    color: rgba(33, 37, 41, 0.9);
}

.mention-empty {
    padding: 10px 18px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* MCP调用详情按钮 */
.mcp-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mcp-detail-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.mcp-detail-btn:active {
    transform: translateY(0);
}

/* 登录遮罩 */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.login-subtitle {
    margin: 8px 0 0 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-error {
    color: var(--error-color);
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.875rem;
}

.login-submit {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    overflow: auto;
    animation: fadeIn 0.2s ease-in;
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s;
    border: none;
    background: transparent;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item {
    margin-bottom: 10px;
    padding: 8px 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.detail-item strong {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    min-width: 80px;
}

.detail-item span {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.code-block {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text-primary);
}

.code-block.error {
    background: #fff5f5;
    border-color: var(--error-color);
    color: var(--error-color);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
    
    .container {
        border-radius: 0;
        height: 100vh;
        overflow: hidden;
    }
    
    header {
        padding: 16px 20px;
        flex-shrink: 0;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        display: none;
    }
    
    .main-layout {
        overflow: hidden;
        min-height: 0;
    }
    
    .sidebar {
        height: 100%;
        overflow: hidden;
    }
    
    .sidebar-content {
        min-height: 0;
    }
    
    .chat-container {
        height: 100%;
        overflow: hidden;
    }
    
    .chat-messages {
        padding: 16px;
        min-height: 0;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-input-container {
        padding: 16px;
        flex-shrink: 0;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* 进度展示样式 */
.progress-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    max-width: 100%;
}

.progress-container.completed {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    opacity: 0.95;
}

.progress-details {
    margin-top: 8px;
    margin-bottom: 24px;
}

.progress-timeline-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.progress-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.progress-stop {
    padding: 4px 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--error-color);
    cursor: pointer;
    transition: all 0.2s;
}

.progress-stop:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color);
}

.progress-stop:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.progress-toggle {
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.progress-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.progress-timeline {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.progress-timeline.expanded {
    max-height: 2000px;
    overflow-y: auto;
}

.timeline-item {
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid var(--border-color);
    padding-left: 16px;
    background: var(--bg-secondary);
    border-radius: 4px;
    transition: all 0.2s;
}

.timeline-item:hover {
    background: var(--bg-tertiary);
}

.timeline-item-iteration {
    border-left-color: var(--accent-color);
    background: rgba(0, 102, 255, 0.05);
}

.timeline-item-thinking {
    border-left-color: #9c27b0;
    background: rgba(156, 39, 176, 0.05);
}

.timeline-item-tool_call {
    border-left-color: #ff9800;
    background: rgba(255, 152, 0, 0.05);
}

.timeline-item-tool_result {
    border-left-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
}

.timeline-item-tool_result.error {
    border-left-color: var(--error-color);
    background: rgba(220, 53, 69, 0.05);
}

.timeline-item-error {
    border-left-color: var(--error-color);
    background: rgba(220, 53, 69, 0.1);
}

.timeline-item-cancelled {
    border-left-color: #ff7043;
    background: rgba(255, 112, 67, 0.12);
}

.timeline-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.timeline-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    min-width: 70px;
}

.timeline-item-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    flex: 1;
}

.timeline-item-content {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tool-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-arg-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-arg-section strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.tool-args {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
    color: var(--text-primary);
}

.tool-result-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-result-section strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.tool-result {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
}

.tool-result-section.error .tool-result {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.tool-result-section.success .tool-result {
    background: rgba(40, 167, 69, 0.1);
    border-color: var(--success-color);
}

.tool-execution-id {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tool-execution-id code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: var(--text-secondary);
}

/* 活跃任务栏 */
.active-tasks-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 12px 0;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 102, 255, 0.15);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.active-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    flex: 1;
    min-width: 0;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.03);
}

.active-task-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.active-task-status {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.active-task-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.active-task-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.active-task-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.active-task-cancel {
    padding: 6px 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 6px;
    color: var(--error-color);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.active-task-cancel:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: var(--error-color);
}

.active-task-cancel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.active-task-error {
    font-size: 0.875rem;
    color: var(--error-color);
}

/* 设置模态框样式 */
.settings-modal-content {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.settings-body {
    overflow-y: auto;
    flex: 1;
    padding: 24px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-group input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group input.error:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

.password-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.tools-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tools-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    overflow: visible;
}

.tools-actions button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.tools-actions button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.tools-actions input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-box {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 150px;
    align-items: center;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    margin-right: 8px;
}

.page-size-selector label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-right: 4px;
}

.page-size-selector select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 70px;
    height: 32px;
}

.page-size-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.page-size-selector select:hover {
    border-color: var(--accent-color);
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.btn-search {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-search:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.tools-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    padding: 8px;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: pointer;
}

.tool-item:hover {
    background: var(--bg-tertiary);
}

.tool-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.tool-item-info {
    flex: 1;
    min-width: 0;
}

.tool-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.external-tool-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ff9800;
    white-space: nowrap;
}

.tool-item-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-item.hidden {
    display: none;
}

.tools-list-items {
    max-height: 400px;
    overflow-y: auto;
}

.tools-pagination,
.monitor-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    background: var(--bg-primary);
    gap: 16px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-controls button {
    padding: 6px 12px;
    font-size: 0.875rem;
    min-width: auto;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-page {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0 8px;
}

.pagination-page-size {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pagination-page-size label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pagination-page-size select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 70px;
}

.pagination-page-size select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.pagination-page-size select:hover {
    border-color: var(--accent-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.btn-danger {
    padding: 10px 20px;
    background: rgba(220, 53, 69, 0.08);
    color: var(--error-color, #dc3545);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color, #dc3545);
    color: #c82333;
}

.monitor-modal-content {
    max-width: 1080px;
    width: 95%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.monitor-modal-body {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 0 0 16px 16px;
    overflow-y: auto;
}

.monitor-sections {
    display: grid;
    gap: 24px;
}

.monitor-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.monitor-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.monitor-section .section-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.monitor-section .section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.monitor-section .section-actions select {
    margin-left: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.monitor-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.monitor-stat-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 102, 255, 0.12);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-xs);
}

.monitor-stat-card h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.monitor-stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.monitor-stat-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.monitor-table-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.monitor-table th,
.monitor-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.monitor-table thead {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

.monitor-table tbody tr:hover {
    background: rgba(0, 102, 255, 0.08);
}

.monitor-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.monitor-status-chip.completed {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.monitor-status-chip.running {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
}

.monitor-status-chip.failed {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.monitor-execution-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monitor-execution-actions button {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.monitor-execution-actions .btn-delete {
    color: var(--error-color, #dc3545);
}

.monitor-execution-actions .btn-delete:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.4);
    color: #c82333;
}

.monitor-vuln-container {
    display: grid;
    gap: 16px;
}

.monitor-vuln-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.vuln-counter {
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 102, 255, 0.12);
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vuln-counter strong {
    font-size: 1.4rem;
    color: var(--text-primary);
}

.vuln-counter span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.vuln-list {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.vuln-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vuln-item:last-child {
    border-bottom: none;
}

.vuln-title {
    font-weight: 600;
    color: var(--text-primary);
}

.vuln-severity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.vuln-severity.critical {
    background: rgba(108, 0, 150, 0.15);
    color: #bf00ff;
}

.vuln-severity.high {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.vuln-severity.medium {
    background: rgba(255, 193, 7, 0.15);
    color: #b8860b;
}

.vuln-severity.low {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.monitor-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.monitor-error {
    text-align: center;
    padding: 24px 16px;
    color: var(--error-color);
    font-size: 0.9rem;
    background: rgba(220, 53, 69, 0.08);
    border-radius: 12px;
}

/* 外部MCP配置样式 */
.external-mcp-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.external-mcp-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.external-mcp-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.external-mcp-stats span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    white-space: nowrap;
}

.external-mcp-stats span strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 4px;
}

.external-mcp-stats span:not(:last-child)::after {
    content: '';
}

.tools-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    flex-wrap: nowrap;
    flex-shrink: 1;
    white-space: nowrap;
    min-width: 0;
}

.tools-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.tools-stats span strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 4px;
}

.tools-stats span:not(:last-child)::after {
    content: '';
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin-left: 8px;
    display: inline-block;
}

.external-mcp-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.external-mcp-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.external-mcp-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.external-mcp-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.external-mcp-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.external-mcp-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.external-mcp-item-info h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-left: 8px;
    white-space: nowrap;
}

.external-mcp-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.external-mcp-status.status-connected {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.external-mcp-status.status-connected::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.external-mcp-status.status-disconnected {
    background: rgba(108, 117, 125, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.external-mcp-status.status-connecting {
    background: rgba(0, 123, 255, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.external-mcp-status.status-connecting::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    display: inline-block;
    animation: pulse 1.5s infinite;
}

.external-mcp-status.status-disabled {
    background: rgba(255, 193, 7, 0.12);
    color: #b8860b;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.external-mcp-status.status-error {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.external-mcp-status.status-error::before {
    content: '❌';
    display: inline-block;
    margin-right: 4px;
}

.external-mcp-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn-small:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-small.btn-danger {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.3);
    color: var(--error-color);
}

.btn-small.btn-danger:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color);
    color: #c82333;
}

.external-mcp-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.external-mcp-item-details > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.external-mcp-item-details > div:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.external-mcp-item-details strong {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.external-mcp-item-details span {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.5;
}

.external-mcp-list .empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.9375rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
}

.external-mcp-list .error {
    text-align: center;
    padding: 24px;
    color: var(--error-color);
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 12px;
    font-size: 0.875rem;
}

.error-message {
    display: block;
    padding: 8px 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    color: var(--error-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

.form-group textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
    resize: vertical;
    min-height: 200px;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-group textarea.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .tools-actions {
        gap: 6px;
    }
    
    .tools-actions button {
        padding: 6px 12px;
        font-size: 0.8125rem;
    }
    
    .search-box {
        min-width: 100px;
    }
    
    .search-box input {
        font-size: 0.8125rem;
        padding: 6px 10px;
    }
    
    .btn-search {
        padding: 6px 12px;
        min-width: 36px;
    }
    
    .page-size-selector {
        font-size: 0.75rem;
    }
    
    .page-size-selector select {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-width: 50px;
    }
    
    .tools-stats {
        padding: 4px 8px;
        font-size: 0.7rem;
        gap: 8px;
    }
    
    .tools-stats span {
        gap: 4px;
    }
    
    .external-mcp-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .external-mcp-stats {
        margin-left: 0;
        width: 100%;
        justify-content: space-around;
    }
    
    .external-mcp-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .external-mcp-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .external-mcp-item-details {
        grid-template-columns: 1fr;
    }
}

/* ==================== 攻击链可视化样式 ==================== */

.attack-chain-modal-content {
    max-width: 95vw;
    width: 95vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.attack-chain-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.attack-chain-controls {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: var(--bg-secondary);
}

.attack-chain-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.attack-chain-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.attack-chain-container {
    flex: 1;
    min-height: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    position: relative;
}

.attack-chain-details {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    max-height: 200px;
    overflow-y: auto;
}

.attack-chain-details h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.node-detail-item {
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.node-detail-item strong {
    color: var(--text-primary);
    margin-right: 8px;
}

.node-detail-item code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
}

.metadata-pre {
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 4px;
    font-size: 0.8125rem;
    overflow-x: auto;
    margin-top: 4px;
}

.modal-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 1rem;
}

.empty-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 1rem;
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--error-color);
    font-size: 1rem;
    padding: 20px;
}
