/* 聊天工作区：主区域 + MCP 侧栏 */
.chat-workspace {
    flex: 1;
    display: flex;
    min-width: 0;
    height: 100vh;
    position: relative;
}

.chat-workspace .main-area {
    flex: 1;
    min-width: 0;
    height: 100%;
}

/* MCP 侧栏 */
.mcp-panel {
    flex: 0 0 320px;
    width: 320px;
    height: 100%;
    background: #2a2b32;
    border-left: 1px solid #40414f;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, margin 0.25s ease;
    z-index: 20;
}

.mcp-panel.is-collapsed {
    transform: translateX(100%);
    margin-right: -320px;
    pointer-events: none;
}

.mcp-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid #40414f;
    flex-shrink: 0;
}

.mcp-panel-collapse {
    width: 32px;
    height: 32px;
    border: 1px solid #565869;
    border-radius: 8px;
    background: transparent;
    color: #ececf1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s;
}

.mcp-panel-collapse:hover {
    background: #40414f;
}

.mcp-panel-collapse-icon,
.mcp-rail-btn-icon {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.mcp-panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #ececf1;
    margin: 0;
}

.mcp-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mcp-panel-loading,
.mcp-panel-empty {
    color: #8e8ea0;
    font-size: 13px;
    text-align: center;
    padding: 24px 8px;
}

.mcp-section-label {
    font-size: 12px;
    color: #8e8ea0;
    margin-bottom: 8px;
}

.mcp-panel-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* MCP 卡片 */
.mcp-card {
    background: #343541;
    border: 1px solid #40414f;
    border-radius: 10px;
    padding: 12px 14px;
}

.mcp-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.mcp-card-head {
    min-width: 0;
    flex: 1;
}

.mcp-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 4px;
    line-height: 1.3;
}

.mcp-card-level {
    font-size: 11px;
    color: #8e8ea0;
}

.mcp-card-desc {
    font-size: 12px;
    line-height: 1.55;
    color: #acacbe;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mcp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mcp-card-meta {
    font-size: 11px;
    color: #6e6e80;
}

/* 开关 */
.mcp-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.mcp-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mcp-toggle-track {
    width: 40px;
    height: 22px;
    background: #565869;
    border-radius: 11px;
    transition: background 0.2s;
    position: relative;
}

.mcp-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.mcp-toggle-input:checked+.mcp-toggle-track {
    background: #19c37d;
}

.mcp-toggle-input:checked+.mcp-toggle-track::after {
    transform: translateX(18px);
}

.mcp-toggle-input:disabled+.mcp-toggle-track {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 收起后的展开按钮 */
.mcp-rail-btn {
    position: absolute;
    right: 0;
    top: 72px;
    z-index: 25;
    writing-mode: vertical-rl;
    padding: 12px 8px;
    border: 1px solid #565869;
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: #2a2b32;
    color: #ececf1;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: background 0.15s;
}

.mcp-rail-btn:hover {
    background: #40414f;
}

.mcp-rail-btn-label {
    display: inline-block;
}

body.mcp-panel-collapsed .mcp-rail-btn {
    display: inline-flex;
}

@media (max-width: 768px) {
    .mcp-panel {
        position: absolute;
        right: 0;
        top: 0;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
    }

    .mcp-panel.is-collapsed {
        transform: translateX(100%);
        margin-right: 0;
    }
}